Using resources in WebView

Put your problem here if it does not fit any of the other categories.

Using resources in WebView

Postby rellimcire » Sat Dec 13, 2008 7:53 pm

My app has ImageButtons that use icons in drawable. I want a help page that can refer to those icons. I made a help html file and put it in assets/help/help.html. Now I can load it using "file:///android_asset/help/help.html".

The problem is how do I access the ImageButton icons? Is there a way for my html file to refer to the resource directory?

I could not find a way, so I thought I'd put the icons in my help directory. Now they are easy to acces from my help.html. However, I have trouble referring to them from my code. My src code looks like this:

ImageButton correctAnswerButton = (ImageButton) findViewById(;
File imgFile = new File("/android_asset/help/check_icon.png");

This fails. I presume android_asset only works for WebView. I cannot find documentation on it anywhere -- I only found out about it from this group.

Is there a way to load an image from assets? Or better, is there a way to refer to resources from an html asset?
Posts: 2
Joined: Tue Dec 02, 2008 7:49 am
Location: Lancaster, CA


Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 15 guests