ImageView setImageURI not showing

by ZoobTheSimian » Wed, 12 Aug 2009 03:46:31 GMT

Sponsored Links
 Hi, all.

I'm having a problem with setImageURI on my ImageView objects. I was
using setimageResource(R.drawable.x), which was working fine, but now
I'm trying to change over to using URIs so that I can be more flexible
about my image source (not constrained to pre-packaged images).

I'm using ImageView.setImageURI(uri), where uri is (for example)
android.resource://com.example.hellogridview/2130837520, which I
created by doing Uri.parse("android.resource://
com.example.hellogridview/" + R.drawable.x). I took this method from
my MediaPlayer, where I created URIs for R.raw wav files from this

It's not throwing any errors that I can see, but it's just displaying
blank images. The images are ~150px each way and I'm displaying them
about half size - would that cause a problem?

Any ideas, please? :)

ImageView setImageURI not showing

by Mark Murphy » Wed, 12 Aug 2009 05:52:45 GMT


I remember some core Android team members giving me odd looks when I
referenced the android.resource Uri scheme in a previous email. I'm not
sure I would count on that scheme, as I suspect it's in a bit of a dusty
Android corner.

Moreover, while I appreciate the elegance of everything-is-a-Uri, there
is no question that different sources of data behave differently. You're
not going to want to call setImageURI() on an http:// URL, for example
-- you want to do the HTTP download in a background thread, cache the
result, etc. Technically, an HTTP Uri might work; practically, it's not
a good solution.

Hence, I'm not convinced the road you're travelin' down is necessarily
the best road.

Mark Murphy (a Commons Guy)  | 

Need Android talent? Ask on HADO! 


Sponsored Links

Other Threads

1. PV Opencore on Gingerbread


  I'm working on a project in which the requirement is to port PV
Opencore on Gingerbread, keeping Stagefright along.  When I include PV
Opencore in build, as expected I'm getting too many conflicts with SF
and OC working together.  Is there anything particular I need to take
care of while I'm doing this?  Or should I just go on fixing
compilation errors?  Any pointers as to how to achieve this (both OC &
SF) on Gingerbread would be very helpful.  Thanks in advance.



2. Listview...


    I am having one listview with background. When i click on a particular
list item of that list view i want to change the color of that item.

    I can be able to change the color  while focusing the list item but i
want to change when the user clicks on that list item.

         Any help please...


3. Google map application now working in Micromax A60

4. Strange behavior in EditText box on Samsung devices

5. Logging should not be Android specific?? Why not SLF4J??

6. How to profile an application for CPU time/ Network io time?

7. [Android update sdk] How to download a specifiy platform from the command line?