-5

I would like to return previous screen on Android when user nudge up the button towards the middle of screen ?

How Can I do this on Android ? I am opening this page with a standart button and calling an activity.

Screen

Screen

bummi
  • 27,123
  • 14
  • 62
  • 101
  • https://stackoverflow.com/q/13095494/5550161 – HB. Nov 20 '18 at 14:31
  • 1
    Possible duplicate of [How to detect swipe direction between left/right and up/down](https://stackoverflow.com/questions/13095494/how-to-detect-swipe-direction-between-left-right-and-up-down) – HB. Nov 20 '18 at 14:33

1 Answers1

2

Use the gesture detection class which is inbuilt in java android to handle the action of user flinging the button upwards. I have forked a sample app that outlines how to implement that. Check it out here. https://github.com/pkavoo/android-BasicGestureDetect

After detecting the upward fling gesture, implement onBackPressed() there.

Polycarp Kavoo
  • 562
  • 5
  • 19