ImageView.setImageURI does NOT work when trying to assign a R.drawable.X Uri

Posted by Qlimax on Stack Overflow See other posts from Stack Overflow or by Qlimax
Published on 2010-02-22T18:29:29Z Indexed on 2010/03/26 23:23 UTC
Read the original article Hit count: 199

Filed under:
|

is related to:

http://stackoverflow.com/questions/2307374/need-suggetsion-about-a-mixed-uri-int-id-images-ambient

now my problem is that:

ImageView imgView=(ImageView)findViewById(R.id.imgView);
Uri imgUri=Uri.parse("android.resource://my.package.name/"+R.drawable.image);
imageView.setImageURI(imgUri);

does NOT work . why?

i know that

imgView.setImageDrawable(Drawable.createFromStream(
                    getContentResolver().openInputStream(imgUri),
                    null));

work.

but that does NOT solve my problem. because I want to set the image with an uri independenty if this come from a resource or come from the camera ACTION_PICK intent...

any suggestions are welcome. Thank you. Regards

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk