-3

I want to increment int variable when I for e.g. swipe to the right, it's possible? I have swipe control code like this ant I want to increment variable myint.

  public void onRightToLeftSwipe(){
            Log.i(logTag, "RightToLeftSwipe!");
            myint = myint + 1;
        }
  • 1
    How are you detecting input? If you properly detect the input (likely with a touch listener) this is possible – zgc7009 Apr 29 '14 at 19:34
  • possible duplicate of [How to detect swipe direction between left/right and up/down](http://stackoverflow.com/questions/13095494/how-to-detect-swipe-direction-between-left-right-and-up-down) – NESPowerGlove Apr 29 '14 at 19:36
  • http://pastebin.com/arK8eRYc here is my Swipe control. – user3586555 Apr 29 '14 at 19:38

1 Answers1

0

I assume your question is where to call this sample method to increase the variable, right?

You need to find a callback which you receive after the swipe and invoke the method there. Depending on how you implement your swipe, your callback can be different (do you implement the swipe yourself or you used a third-party component for it?)

m.hashemian
  • 1,786
  • 2
  • 15
  • 31