views:

44

answers:

1

Hello, how can I show pictures in WebView without saving images into file system?

I have tried to implement my custom ContentProvider, but method openFile returns ParcelFileDescriptor that points into filesystem (or socket). My pictures are in filesystem, but in encrypted form.

I have tried also URL.setURLStreamHandlerFactory, but in android java it is useless (because custom streamHandler can be register in jvm that is not allowed).

I also try html code "img src=\"data:image.gif;base64,R0lGODlhiAAkAMQAANOOk...", but in embedded chrome it's not working :(

pls help

A: 

There is a bug in Android you cannot load images with Base 64 on a webview like that(ur last approach)...

http://code.google.com/p/android/issues/detail?id=596

Check this link out may be you can try with this approach of using content providers

http://blog.tourizo.com/2009/02/how-to-display-local-file-in-android.html

http://www.techjini.com/blog/2009/01/10/android-tip-1-contentprovider-accessing-local-file-system-from-webview-showing-image-in-webview-using-content/

or

http://downloadandroid.info/2010/07/how-to-display-an-image-from-the-sdcard-in-webview/

Rahul
thanks a lot, first link works. Great.
Peter
I've got a mistake in html code:img src="data:image.gif;base64,R0lGODlhiAAkAMQAANOOk...correct is (typo in mimetype):img src="data:image/gif;base64,R0lGODlhiAAkAMQAANOOk...
Peter