Search code examples
androidandroid-gallery

In an Android Gallery, how do you listen to a locked in image?


When I flip through an Android Gallery, it moves to an image and the focus locks in on it. Which event should I listen to for the image lock in?


Solution

  • Try below code

    mCoverFlow.setOnItemSelectedListener(new OnItemSelectedListener()
    {
        @Override
        public void onItemSelected(AdapterView<?> arg0, View v, int position, long arg3)
        {
            // position will give you the locked item
        }
    
        @Override
        public void onNothingSelected(AdapterView<?> arg0)
        {
        }
    });