Discussion Forums  >  Images, Documents, File Locations

Replies: 20    Views: 186

hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
01/17/13 09:33 AM (13 years ago)

how to add images to custom html/text screens.

I was wondering how to add images to this page. Since there is no "insert image" tool on the editors page, how do you code it and reference it to the drawable folder. Btw, this is for Android if that matters. Thanks, Howard
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
01/17/13 09:54 AM (13 years ago)
I know how to call image from url but never used direct to folder although I think you would just substitute the url for the filepath. <img src="url or filepath goes here"> Hope this helps but sure someone will give a more detailed explanation.
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 09:59 AM (13 years ago)
so would the file path be: "res/drawable/filename.png"?
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
01/17/13 10:03 AM (13 years ago)
Something like that. Let me know how you get on as will be doing it that way myself from now on.
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 10:03 AM (13 years ago)
just tried it but no luck!
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
01/17/13 10:06 AM (13 years ago)
Hey @hashner, Try putting the image/pic in the same folder as the html. LA
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 10:07 AM (13 years ago)
I don't think that would work, (but I've never tried it) because the customHTML file is hosted on the net not in the app. If it does happen to work, the way to do it would be to put the image in the assets folder of the project and call it with - file:///android_asset/imagename.png *edit* <img src="file:///android_asset/imagename.png" />
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 10:12 AM (13 years ago)
@LA I copied and pasted the source into the page. Currently I have a custom URL page and have it directed to a page of my main website, which I am trying to get away from. I would rather have it all contained in the app. I tried using the Html doc screen, but then realized I still lose the feature of changing the settings in the Theme to change it throughout the app. hope that makes sense. Thanks, Howard
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 10:15 AM (13 years ago)
Howard, can you grab the page that the customURL points to? You could put that page, complete with images, css etc into the assets folder, and still using the customURL, change the link to file:///android_asset/pagename.html This is the way I do it, I never use that customHTML thing, too unpredictable.
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
01/17/13 10:17 AM (13 years ago)
@hashner, If you put the html in your assets-BT docs, then under your html under your image/pic put this: src="name.png" of course replacing name with your image name. Put the png in the same folder then it will work and be all contained in the App. Hope this helps. LA
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 10:18 AM (13 years ago)
@rave, Then I would put the html page in the asset folder, so it will still be part of the app....sounds interesting.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 10:22 AM (13 years ago)
@hasher13, yes, you can treat the assets folder as you would a regular web directory, even to the structure - like images, css, javascript in their own folders.
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 10:24 AM (13 years ago)
Okay, so this is what I have done and my thoughts @rave, use the reference <img src="file:///android_asset/imagename.png" /> and placing the image in the asset folder, worked perfectly. And I believe that will actually help me in my other apps. so thank you so much for that. Now to use custom HTML or custom url and place the html page in the asset folder to make it local. hmm, well if I do custom url, and by some chance need to change the text of the page, I would have to upload a new apk with the new version of the html for it go live...is that correct? With using the custom HTML, I am able just to change the text, which would push the changes to the end user without having to upload a new apk. Does this all sound correct? Thanks again. I love learning new things h-
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 11:02 AM (13 years ago)
That sounds right! If you're going to be making many changes then don't put it in the assets. Suppose you have to weigh up the options. In the assets it can be viewed offline, which is essential for some users... but online allows on the fly changes..
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/17/13 11:07 AM (13 years ago)
Very interesting. anybody worked with Jquery in this manner
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/17/13 11:08 AM (13 years ago)
thanks
 
hasher13
Android Fan
Profile
Posts: 376
Reg: Jul 21, 2012
Wethersfield
8,060
like
01/17/13 11:12 AM (13 years ago)
@web, with my other app, I have jquery tabs but it is off my website which I would like to make local as well, but couldn't figure it out. With this new info, I have to revisit that. Thanks again,
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 11:21 AM (13 years ago)
@web, yes, jquery works in this manner. Have you used phonegap (web based apps - html5/jquery) at all? All the phonegap output goes in the assets folder.
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/17/13 11:25 AM (13 years ago)
@raveyd I have a phone gap account but have not used it enough to understand their methods. Are you making mention of phone gap as a practical way to learn file placement and then apply it to buzz touch? just trying to get your drift
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/17/13 11:42 AM (13 years ago)
Sorry mate, what I mean is, they use jquery and html and they put everything (javascript, images, css, html) in the assets folder. All I'm saying is that we can do the same with bt. The assets folder can be treated just like a regular web directory. But yes, phonegap is a great way to learn about mobile web.
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/17/13 11:48 AM (13 years ago)
thanks @raveyd
 

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.