reset password
Author Message
lbriggs
Posts: 57
Posted 16:41 Apr 26, 2014 |

So I got my Swipe app working, but I had to hack it together a bit. I am setting an onClickListener to detect the swipe.

To set the onClickListener I first have to find the widgets ID, then apply the listner. But when I try this on the Activities onCreate() method the find call returns null. I have to set it on another function that gets called after the view gets drawn (an onClick() method of an imageView). Is there a way I can call this on the onCreate() or onResume() method instead of this onClick method?

 

Thanks

msargent
Posts: 519
Posted 17:56 Apr 26, 2014 |

To detect a swipe you need to override the activity's onTouch method, taking the event that's passed into it and passing it to a GestureDetector that has a listener passed into it that has implemented onFling().

Last edited by msargent at 18:00 Apr 26, 2014.