How to setImageViewUri in Widget using getFileStreamPath()?

by Matt M » Sun, 13 Mar 2011 02:44:23 GMT


Sponsored Links
 Hello,

This is really baffling. In an AppWidgetProvider I am trying to
setImageViewUri using this Uri: Uri.fromFile(getFileStreamPath(name))

I know the file exists in internal storage because I've tried
File.exists(), and I also successfully tried:

Bitmap b =
BitmapFactory.decodeFile(getFileStreamPath(path).getAbsolutePath());
views.setImageViewBitmap(id, b);

I need to do this with 3 images of varying size so converting to a
Bitmap is out of the question (I get a Failed Binder Transaction
regularly).

Why is it that I can use the same getFileStreamPath to create a bitmap
but cannot create the Uri to use in setImageViewUri? (this is all in
an AppWidgetProvider)

Any help would be greatly appreciated!

Matt.

-- 



Re: How to setImageViewUri in Widget using getFileStreamPath()?

by Kostya Vasilyev » Sun, 13 Mar 2011 03:00:35 GMT


 Matt,

I'm assuming your widget is running inside the home screen application 
(Launcher2 by default).


The launcher is a separate application from your own, and therefore 
cannot access files stored in your application's private data storage 
directory.


Create these image files someplace where other applications (including 
the launcher) can read them.


-- Kostya

12.03.2011 21:44, Matt M :
Hello, This is really baffling. In an AppWidgetProvider I am trying to setImageViewUri using this Uri: Uri.fromFile(getFileStreamPath(name)) I know the file exists in internal storage because I've tried File.exists(), and I also successfully tried: Bitmap b = BitmapFactory.decodeFile(getFileStreamPath(path).getAbsolutePath()); views.setImageViewBitmap(id, b); I need to do this with 3 images of varying size so converting to a Bitmap is out of the question (I get a Failed Binder Transaction regularly). Why is it that I can use the same getFileStreamPath to create a bitmap but cannot create the Uri to use in setImageViewUri? (this is all in an AppWidgetProvider) Any help would be greatly appreciated! Matt.
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --


Sponsored Links


Re: How to setImageViewUri in Widget using getFileStreamPath()?

by Matt M » Sun, 13 Mar 2011 03:11:59 GMT


 Thank you for your replay Kostya.

The solution I chose was to change the privacy during saving. Changed
openFileOutput(file, Context.MODE_PRIVATE) to openFileOutput(file,
Context.MODE_WORLD_READABLE)

Thank you.

Matt.




-- 



Other Threads

1. How to synch SQL Lite database up with Database server

I'm curious if there is any tutorials on synching up a database server
with the SQL Lite Database on the Android device?

Still new to Android development but would like to read up on this
aspect! Thank you.

-- 

2. stripped down linux

hi,


    What does stripped down linux mean??????


thanks and regards,
Ajay

-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. developing a driver on beagle board

4. Loading music files into the emu android

5. Turning On 'Allow Mock Locations'

6. Speed from GPS

7. Developing using Eclipse for Android and Java desktop application