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. How to change application theme at runtime

Hi friends,

I want to know is it possible to change theme of an android
application at runtime, say by clicking a button in application
itself. I want my application to behave in same manner as we see while
changing theme of mobile display.

Any help would be highly appreciated.


2. medical charge capture

Is anyone working on a medical charge capture program for physicians
to track patient hospital visits and procedure?  The Palm platform had
several, Pocket Practitioner by pocketinformatics being one.  This
would be quite helpful.


3. Is it possible to design an app with 45M of mp3 files included?

4. Cannot get MSISDN (phone number) but can get IMSI on HTC G3

5. Including Third party Jars

6. Android 1.5 upgrade

7. Communication between AppWidgetProvider and Configuration Activity