Question

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!

Was it helpful?

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
    }
});

OTHER TIPS

For that Purpose you needs To create a custom gallery and override onFling() method of GestureDetector class. and in that method you can easily detect your view sliding directions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top