Search code examples
androidimage-galleryandroid-gallery

selecting an Image from Grid and displaying it in Gallery View in android application


I wanted select an Image from the GridView of Activity and wanted to send its position to Gallery View to display it as CurrentView in Gallery. I am able to create Gallery Activity and GridView Activity. However I am unable select the Gallery current Image position when Gallery Activity is started. means my selected item in my GridVIew in first activity should be the current visible item in Gallery Activity. Could any one please tell me a way to choose current displayed Image view in Gallery Activity.

I think I need to make some changes in my Gallery Adapter. But I don't have clarity. any API code snippets please.


Solution

  • Found the answer, simple API:

    gallery.setSelection(currentImage);