How programmatically click on Android "back button" from an application? Is it possible?
Like adb shell input keyevent 4
Asked
Active
Viewed 593 times
-1

Michael Dodd
- 10,102
- 12
- 51
- 64

ignn
- 29
- 4
-
what you mean by application ? – Ashish Jul 10 '19 at 12:12
-
If you are asking about touch event from ADB then see https://stackoverflow.com/questions/18924968/using-adb-to-access-a-particular-ui-control-on-the-screen .. – ADM Jul 10 '19 at 12:13
-
onBackPressed()? – CoderUni Jul 10 '19 at 12:13
-
override fun onBackPressed() { super.onBackPressed() } – CoderUni Jul 10 '19 at 12:13
-
Thank you. But onBackPressed for Back button. What if i want click and another buttons? – ignn Jul 10 '19 at 12:56
1 Answers
1
There is default method can be use for back press,
@Override
public void onBackPressed() { return; }
By Overriding this method you can access Back button grammatically. Usually, Back button is already called as default method in android but backPressed can be useful while using navigation Drawer or menu

satyakiran vakada
- 61
- 4