Sunday, October 3, 2010

[android-developers] Re: Creating URI from resource Id

Haha! Why?

Well I have a resource folder full of images, and I know the reference
to them (R.drawable.image) and I want to call a method which loads a
bitmap given the URI to it. For some reason this method takes the URI,
rather than the drawable reference.

Does that make sense?

On Oct 3, 8:24 pm, Kumar Bibek <coomar....@gmail.com> wrote:
> Even I am confused. :) Why do you want that?
>
> -Kumar Bibekhttp://techdroid.kbeanie.com
>
> On Oct 3, 4:59 pm, Neilz <neilhorn...@gmail.com> wrote:
>
> > Hi. I'm sure this is simple, but I've got myself confused over it...
>
> > I have an image resource, such as R.drawable.myimage, and I want to
> > convert this into a URI.
>
> > I tried:
>
> > Uri selectedImage = Uri.parse("android.resource://com.my.package/" +
> > resourceId);
>
> > ...but this just returns a NullPointer. The resourceId needs to be
> > dynamic (so I can pass any image to it), not just a hardcoded
> > "myImage".
>
> > Any help please?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate