2

I have a custom gallery in my app and after doing some testing I've decided that I don't want the gallery to navigate with finger swipes. I've set up a left and right button to control it instead. Now I want to figure out how to disable the onFling method. I've tried this.setEnabled(false); which didn't work, and tried this.setClickable(false); which didn't work... also my overridden onFling() method has everything except the return(true); commented out.... not sure what else to try! Any ideas??

Thanks :)

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Emma Assin
  • 851
  • 2
  • 12
  • 23

2 Answers2

7

A better approach (as described here) is to override the fling method in your custom gallery class:

@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                       float velocityY) {        
    return false;
}
Community
  • 1
  • 1
Ljdawson
  • 12,091
  • 11
  • 45
  • 60
-1

Oh, got it!

In my custom gallery class:

@Override
public boolean onTouchEvent(MotionEvent event) {
    return false;

}

Figured that put from the gallery source code posted here: http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/Gallery.java.shtml

:)

Emma Assin
  • 851
  • 2
  • 12
  • 23