Discussion Forums  >  Images, Documents, File Locations

Replies: 25    Views: 147

LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
11/24/13 06:42 AM (10 years ago)

HTML screen not displaying in Android

Hi, I'm having trouble with the custom html plug in for Android. Instead of loading the document, the emulator loads a page which says "open document". Any help gratefully received. Thanks.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/24/13 06:57 AM (10 years ago)
Android uses helper applications to view documents. If you would have pressed the button to say 'open document' you would have been provided a choice of suitable applications from which to open the document. Choices would have been things like 'Internet', 'Google Chrome', and other web capable viewers. Cheers! -- Smug
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
11/24/13 07:18 AM (10 years ago)
Thanks Smug, that makes sense. However, when I click on 'open document' it seems to load an html viewer but all I can see is image placeholders (question marks) and nothing else. These are the same html docs that run brilliantly on iOS.
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
11/24/13 07:21 AM (10 years ago)
Thanks Smug, that makes sense. However, when I click on 'open document' it seems to load an html viewer but all I can see is image placeholders (question marks) and nothing else. These are the same html docs that run brilliantly on iOS.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/24/13 07:29 AM (10 years ago)
Heh. What I wouldn't give to have Android as responsive as iOS. Of course, giving the benefit to the Android gurus, they wonder what the heck is wrong with 'me', so… :) It comes down to two questions: 1) Is the document (html) linked via a URL from the web? 2) Is the document (html) linked as a 'local' file? If (1), then I'd also check with a browser, just to make sure. If (2), then I'd make sure I (correctly) added the resources (documents) to the project before running it again. Also, in Android, you can never 'clean' your project too often. I also delete the app from my device fairly often as well. Sometimes, it seems the cache doesn't get cleared the way I think it should. Run through those scenarios and let us know how it goes… Cheers! -- Smug PS, if you reload a page you posted on, it will double post. Exit the page, and re-enter, don't just refresh. :) Edit: Oh, and one more thing. If the html document is asking for an image, that image needs to be located 'relative to the html document', which means NOT in /res/drawable, as if it were a 'system' image. It needs to be with the html document (in BT_Docs), and not in a subdirectory.
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
11/24/13 08:12 AM (10 years ago)
It's a local file. The html file is in the BT_docs folder and the app is definitely recognising it's there. The images are in the res>drawable folder. This is working for e.g. header images. Your suggestions did work. I got one html file working, but when I went through the same process for a second (deleting, copying back in, cleaning and re-running) it didn't work...and the first one stopped working too! Maddening! Think I'm going to have to walk away and come back when I can summon some more patience.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/24/13 08:33 AM (10 years ago)
Heh. Patience is a virtue… I don't possess, lol! Android will do that to you. Step back a minute and relax. It's frustrating for everyone, not just you. Fortunately, things are better (Android wise) in API 11 over API 8. But still a bit tedious. Good Luck, try and have fun, and if you get bogged down, the forum is just a click away! Another thing that helps from time to time is to update your BT_config.txt file, located in the Android Assets directory. You can get a 'new copy' from your BT Control Panel. Look for the link that says (and I always get self hosted and bt hosted mixed up) either 'Configuration Data' or 'Json Data'. Copy that, run it through jsonlint.com if you want it to be pretty and readable, and pasted it over your existing config, effectively replacing the old data with new data. That way, if things have radically changed, your app will have a recent set of configuration data handy, and it won't be weird until the refresh. However, if you add new plugins that weren't downloaded with your package, you'll have to download another package. Cheers! -- Smug
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
11/24/13 08:54 AM (10 years ago)
Patience isn't my forte either! That said...I think you've inadvertently resolved my issue! I'm using API 14, but I had it pointed at Android 4.0 rather than Google APIs 4.0. I've changed that and it's working fine. D'OH! My images still aren't showing up, but that must be a referencing issue, which I'll get to tomorrow. Thanks so much :)
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/24/13 03:16 PM (10 years ago)
Hi @cfg1006, Try putting the html doc and images in the same folder. See if that works. LA
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
11/25/13 06:28 AM (10 years ago)
Thanks for the suggestion LA, but that didn't work I'm afraid :(
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/25/13 07:58 AM (10 years ago)
You'll have to take a look at the html documents, and see how they are referencing the images. It's possible you may need to make some edits to those references to work with Android. 1) No numbers as a leading character. Will not work. Will cause errors. 2) Your HTML Document will be in BT_Docs. So should the images referenced by HTML. 3) If your html references a subdirectory, change it. <img src="./dir2/image.png"> will not work. It needs to be <img src="image.png"> and you'll be good. 4) No spaces in filenames. None. Zilch. Nada. Zero. 5) If I remember anything else I'll let you know. But check those points. Cheers! -- Smug
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
11/25/13 02:04 PM (10 years ago)
Couldn't said it better Smug! LA
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/12/13 06:46 AM (10 years ago)
Unfortunately after much playing around, I am still flummoxed by the fact my images are not showing up in my Android HTML files :( There are no numbers in any of my .png files or html files I have placed the images in the BT_docs folder I have triple checked that there are no subdirectory references There are no spaces in my file names I have refreshed and cleaned the project innumerable times When I click the html files in eclipse, the images show up in the viewer window. As soon as I run it on an emulator/ device however, I just get placeholders. I have tried different html readers, none of which have helped. I'm very obviously doing something wrong but I can't for the life of me work out what it is! If there is ANYTHING else I could try, however remote the chances of success, please do let me know!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/12/13 02:46 PM (10 years ago)
Can you 'physically' ensure that the image files are in your BT_Docs, not from within eclipse, but via Finder/Windows Explorer ? Cheers! -- Smug
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/17/13 04:07 AM (10 years ago)
Yep. Definitely there. This really is driving me mad! Thanks
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/17/13 04:17 AM (10 years ago)
If it helps at all, logcat is showing "Exception: content://com.android.htmlfileprovider/data/data/com.lashealthandwellbeingandroid/files/creditsmall.png"
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/17/13 02:22 PM (10 years ago)
Can you send me a copy of your HTML File? Or if it's not that big, post it here? Cheers! -- Smug
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/19/13 09:15 AM (10 years ago)
Sure, here's one of the simple test files I'm using. I've created it using Kompozer. Thanks <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>fruit</title> </head> <body alink="#000099" bgcolor="white" link="#000099" text="#333333" vlink="#990099"> <table border="0" cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr> <td align="right" valign="middle"><img alt="" src="dieticon.png" height="30" width="30"><br> </td> <td colspan="1" rowspan="1" align="center" bgcolor="transparent" valign="middle"><b><big>Fruit</big></b><br> <br> </td> <td valign="middle"><img alt="" src="dieticon.png" height="30" width="30"><br> </td> </tr> <tr> <td colspan="3" rowspan="1" valign="top"><br> Fruit can help satisfy sugar cravings, which are often experienced when we are under stress.<br> </td> </tr> <tr> <td colspan="3" rowspan="1" valign="top"><b><br> </b><img alt="" src="apple.png" align="left" height="100" width="100"><br> <b>Apples</b> contain <b>phosphorus</b> and <b>iron</b> and help to reduce oxidative stress. <br> <br> The skin is one of the first parts of the body to show signs of stress and apples can help to counter this as they play a part in the regeneration of healthy skin and hair tissues.<br> <br> Apples should not be eaten on an empty stomach as this can lead to indigestion.<br> <br> </td> </tr> </tbody> </table> <br> <table border="0" cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr> <td rowspan="1" colspan="1" align="left" valign="middle">&nbsp;<img alt="" src="avocado.png" align="right" height="100" width="100"><br> <b>Avocados</b> lower blood pressure thanks to high levels of <b>potassium</b> and <b>healthy (monounsaturated) fat</b>.<br> </td> </tr> </tbody> </table> <br> <table border="0" cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr> <td colspan="1" rowspan="1" valign="middle"><img alt="" src="banana.png" align="left" height="100" width="100"><br> <b>Bananas</b> are packed with vitamin B, potassium and carbohydrates. <br> <br> <b>Vitamin B</b> keeps blood pressure and stress hormones in check during high-tension situations. <br> <br> <b>Potassium</b> deficiencies are associated with breathlessness, fatigue, insomnia and low blood sugar which are often triggered by stress. Potassium is also essential for healthy heart muscles.<br> </td> </tr> </tbody> </table> <br> <table border="0" cellpadding="2" cellspacing="2" width="100%"> <tbody> <tr> <td colspan="1" rowspan="1" valign="middle"><br> <img alt="" src="mango.png" align="right" height="100" width="100"><b>Mangoes</b> have a very high vitamin C content.<br> <br> <b>Vitamin C</b> is an antioxidant which slows down the aging process as well as boosting energy.<br> <br> </td> </tr> </tbody> </table> <br> <br> </body> </html>
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/19/13 09:31 AM (10 years ago)
There is also a doc type specified (but not editable within Kompozer) so first line should actually be <Doctype! html PUBLIC "-//W3C//DTD HTML 4.01//EN "http://www.w3.org/TR/html4/strict.dtd">
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/19/13 02:04 PM (10 years ago)
If this file resides in your 'BT_docs' directory, so should apple.png, mango.png, and all of your other images. This is the case? Where does the file 'creditsmall.png' come into play? Cheers! -- Smug
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/22/13 12:06 PM (10 years ago)
They are all very definitely in the Bt_docs directory. For absolute clarity I'm using the core (3.0) for this. Don't know if that makes any difference. Creditsmall is from another of my test files, not this one. The exceptions are exactly the same though, except the file name of course. My software engineer other half has had a look and he can't figure it out either. App building and eclipse are not his thing, but at least I know there's nothing wrong with the HTML. I may have to give up on this and try another plug in which will do what I need it too :(
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
12/22/13 02:04 PM (10 years ago)
So turns out 3.0 makes ALL the difference. I've gone back to 2.0 and it works absolutely fine. The images show up and it's not even asking me about the html viewer- just taking me straight to the HTML file. Is this a 3.0 bug perhaps? This has at least stopped me throwing my mac out of the window. For now at least!! Thanks
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/22/13 02:17 PM (10 years ago)
Hmm. Glad you're working. Still curious about the v3 situation, but as long as it's working now, that's the major thing. Cheers! -- Smug
 
pdog
buzztouch Evangelist
Profile
Posts: 106
Reg: Nov 20, 2013
Kelowna, BC, Ca...
6,310
like
01/02/14 09:11 PM (10 years ago)
If it makes you feel any better I have the exact same problem: - app works fine in 2.0 - html doc screens with links to each other and images - nothing fancy in my app, just a simple menu and html docs, all offline - all html files and images in the BT_Docs folder - no funny filenames (and besides, it works in 2.0 anyway) - was told it was better to be using 3.0 so I've spent the last 2 days getting very frustrated not having images show like they used to, and html screens not linking to each other like they used to - also in 3.0 I get the silly "Open document" screen every time, and never had that before either: ref: https://www.dropbox.com/s/agkg7yq7fevygsb/2014-01-02_16-50-46.png <-- this will kill any hope of users adopting my app - I have even reached the point of Googling "android app builder for html screens" as an alternative to BT I will go back to 2.0 as I need to move forward with my app. I hope that BT never forces me to leave 2.0 without getting those bugs fixed. -Pdog
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/03/14 09:41 PM (10 years ago)
PDog: I found a workaround for the HTML Doc in BTv3; it's basically the v2 plugin adapted to v3. I haven't formalized it into a plugin (always a 'to do list' item around…) but if you're not afraid to edit manually, the code can be found as referenced by this post: http://www.buzztouch.com/forum/thread.php?tid=A4A8028CBD94ED3F9249414&fid=5FE1FB2355A48AD674A6CA3&sortColumn=FT.id&sortUpDown=DESC&currentPage=2 Cheers! -- Smug
 
pdog
buzztouch Evangelist
Profile
Posts: 106
Reg: Nov 20, 2013
Kelowna, BC, Ca...
6,310
like
01/04/14 01:04 AM (10 years ago)
Hmm this comment in that thread "If you need a current plugin with the old style behavior, you'll have to cut/paste the new code over the old. But be careful! I did not include 'all' functionality into my replacement code. It will display a file, and that's about it. Any email link, or back button, or any 'additional' functionality has not been implemented. " ...lends me to believe that it won't help me. I have html docs that have e.g. the email mailto: link in them which doesn't sound like it's supported. Frankly I'm surprised that the html doc doesn't let me simply show the user some html like it did in v2.0. I will have to publish on 2.0 for now as I can't spend any more time on this. My market awaits. Thanks anyway.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.