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
path.

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)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Need Android talent? Ask on HADO!  http://wiki.andmob.org/hado 

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


Sponsored Links


Other Threads

1. How to install plugins into Android's browser

Hi all.

I have the next problem:

I have an NP API plugin for Android's browser, it works properly. I
have to go to the command line and to input some commands of copy
plugin's so file into emulator (with help of adb) for installing it.
However, for end user it is too complicated to input this commands.

How can I prepare installer for my native plugin?
--~--~---------~--~----~------------~-------~--~----~

2. diff label for icon and searchable item text.

I want to have a different text string for my icon and the text that
appears in Searchable Items (QSB).

I have the following lines in my AndroidManifest.xml --

    <application android:icon="@drawable/icon"
                 android:label="@string/IconText"

And my searchable.xml looks like this --

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
            android:label="@string/SearchName"
            android:searchSettingsDescription="@string/
SearchDescription"


However, when I go into [home] > [menu] > Settings > [Search] >
[Searchable items]

I see the android:label in the AndroidManifest.xml (application node).

How do I specify a different text string for Searchable Items ?

tia.
--~--~---------~--~----~------------~-------~--~----~

3. Fast test for internet connectivity

4. Hola

5. Video problem - How to use a surface for both canvas and mediaplayer

6. can anybody tell pls....

7. Archos 5 Android: new firmware w/ ADB support