Search code examples
androidgalleryview

GalleryView Item Change Listener


I want to detect the gallery view slide to next item in Android like if gallery view current index is 0 if slide the gallery view to next image i want to detect this event item change listener on slide event in android!I have no idea for this concept pls help me any one Thanks!


Solution

  • I found my answer. Using setOnItemSelectedListener slide or keypress it is easy to find current item focused:

    g.setOnItemSelectedListener( new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) {
            Log.v("Changed----->", ""+pos);
            change_position=pos;
        }
    
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub
        }
    });