Skip to content Skip to sidebar Skip to footer

Android Gallery Display Selected Image

I the following code i am trying to display the image that is selected in the gallery.But i get a default android image and not the image that i saved.What am i doing wrong how to

Solution 1:

The method inside your ImageAdapter called public Object getItem(int position) should be modified to return the appropriate mImageIds[] by using the position argument. Then, inside onItemClick, you can call parent.getItemAtPosition(position) to get the resource id.

If you want to use that method for things other than the ids, you can write your own get method (which I'd call getResourceId), and call ((ImageAdapter)parent.getAdapter()).getResourceId(position)).

Post a Comment for "Android Gallery Display Selected Image"