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. getProviders(true) always return empty list

Hi all,

I have a problem using getProviders(true) function.

The code is following is tested (SDK1.6) is tested on emulator and
actual phone (I checked if GPS is working on other applications).

Location Manager manager =
List<String> providers = manager.getProviders(true);

Also I have following permissions in manifest xml file:
<uses-permission android:name="android.permission.INTERNET" />
android:name="android.permission.ACCESS_COARSE_LOCATION" />
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" /
<uses-permission android:name="android.permission.ACCESS_GPS" />
android:name="android.permission.ACCESS_MOCK_LOCATION" />

Kind Regards.


2. Password and SQLite security

I have been searching on google for information regarding application
passwords and SQLite security for some time, and nothing that I have
found has really answered my questions.

Here is what I am trying to figure out:

1) My application is going to have an optional password activity that
will be called when the application is first opened.  My questions for
this are a) If I store the password via android preference or SQLite
database, how can I ensure security and privacy for the password, and
b) how should password recovery be handled?

Regarding b) from above, I have thought about requiring an email
address when the password feature is enabled, and also a password hint
question for use when requesting password recovery.  Upon successfully
answering the hint question, the password is then emailed to the email
address that was submitted.  I am not completely confident in the
security and privacy of the email method, especially if the email is
sent when the user is connected to an open, public wireless network.

2) My application will be using an SQLite database, which will be
stored on the SD card if the user has one.  Regardless of whether it
is stored on the phone or the SD card, what options do I have for data
encryption, and how does that affect the application performance?

Thanks in advance for time taken to answer these questions.  I think
that there may be other developers struggling with the same concerns.


3. New shopping new life!

4. Strange timezone issue, when I set timezone to Alaska

5. ProgressDialog in full screen

6. Invoke GlobalActions dialog (Shutdown/Reboot...) on Android-x86

7. Sori, test