Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Android Gallery widget to show specific starting image

I have a task where the user can select an image from a GridView representing a photo album, and from this I start a new activity which displays a Gallery widget to show the images of the photo album. However, I can't seem to get the Gallery widget to show the contents of the photo album with a given image as the starting point. Ideally I would like a Gallery#setStartingImage(int position) or something similar.

Any ideas would be greatly appreciated.

like image 521
Dalmazio Avatar asked Feb 18 '10 00:02

Dalmazio


1 Answers

After looking a little deeper into the inheritance hierarchy of Gallery, I found the method setSelection() defined in the AbsSpinner class which Gallery extends. This seems to do the job.

like image 86
Dalmazio Avatar answered Nov 04 '22 06:11

Dalmazio