Clarification on loading local images with WebView

by Jeff Thorn » Fri, 14 May 2010 06:42:22 GMT


Sponsored Links
 Regarding option 1 - if I create a content provider it appears I need to
implement the openFile method and return a ParcelFileDescriptor. Sounds easy
enough.  But how do you create a File object from something in the assets
directory?






As I wrote in my previous reply:


Try creating a ContentProvider to serve the image, and see if you have
better luck with a content:/...

Not if your image is only in an asset. The image viewer won't have
rights to access it.


Not directly, but you can use the 2D graphics API (e.g., Canvas and
friends). Basically, you're looking to use the same techniques games do
to view a portion of a large map, for example.

--

Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
http://commonsware...
Android Online Training: 21-25 June 2010:  http://onlc.com 


--



Clarification on loading local images with WebView

by Mark Murphy » Fri, 14 May 2010 06:51:08 GMT


 


Perhaps use openAssetFile() instead?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

--


Sponsored Links


Clarification on loading local images with WebView

by Jeff Thorn » Fri, 14 May 2010 07:18:31 GMT


 You would think huh? But I got the impression for the docs that that method
just allows you return a file segment using an offset and length.

Can you do something like:

File f = new File("assets/myfile.png");

I wish you could create a ParcelFileDescriptor with something Oberlin than a
File.






Perhaps use openAssetFile() instead?

--

Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 

 http://commonsware.com/blog  |  http://twitter.com/commonsguy 
Android App Developer Books:  http://commonsware.com/books 


--



Clarification on loading local images with WebView

by Jeff Thorn » Fri, 14 May 2010 07:21:24 GMT


 PS - meant something OTHER than. Droid autospell. :)




You would think huh? But I got the impression for the docs that that method
just allows you return a file segment using an offset and length.

Can you do something like:

File f = new File("assets/myfile.png");

I wish you could create a ParcelFileDescriptor with something Oberlin than a
File.









Groups "Android Developers" group.
To post to this group, send email to android-develop...@googlegro...

--



Clarification on loading local images with WebView

by Mark Murphy » Fri, 14 May 2010 07:38:06 GMT


 



Hmmmm...yeah, I was probably a bit too off-the-cuff with that
recommendation. I had done a ContentProvider to serve large images to a
WebView, but it wasn't an asset. It doesn't look like doing one from an
asset will be terribly simple.

Sorry!

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training in NYC: 4-6 June 2010:  http://guruloft.com 

--



Clarification on loading local images with WebView

by Jeff Thorn » Fri, 14 May 2010 08:14:59 GMT


 I appreciate your help. I think I will just open the large image in a new
custom Activity.









Hmmmm...yeah, I was probably a bit too off-the-cuff with that
recommendation. I had done a ContentProvider to serve large images to a
WebView, but it wasn't an asset. It doesn't look like doing one from an
asset will be terribly simple.

Sorry!

--

Mark Murphy (a Commons Guy)

 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.c ...
Android Training in NYC: 4-6 June 2010:  http://guruloft.com 


--



Other Threads

1. CursorTreeAdapter ?

Hi Mihai,

I get the same stack trace intermittently when deleting a group in
ExpandableListView. I think it's to do with whether your groups are
expanded. There's a bug raise on this issue here...
http://code.google.com/p/android/issues/detail?id=553

-Andy



--~--~---------~--~----~------------~-------~--~----~

2. Audio formats in MediaPlayer

Hi,

I have implemented a mediaplayer and it works fine with MP3 files.
Trying some other format does not work. Has any one tried and
succeeded to play another format then MP3?

Tanks for helping!
--~--~---------~--~----~------------~-------~--~----~

3. Determining active application

4. android.app.ServiceConnectionLeaked

5. Animate Overlays on MapView

6. Changing default link color

7. Changing the 9 patch when selected?