开发者

need the script for back button emulation

开发者 https://www.devze.com 2023-01-31 13:55 出处:网络
can someone tell me what script/command I need to run on a rooted phone to emulate android\'s hardware back button?

can someone tell me what script/command I need to run on a rooted phone to emulate android's hardware back button?

I'm trying to create a always-on-screen back button and its code is all set. Now I'm looking for a script/command which can emulate android's hardware back key press and set it to whatever app is active. something like http://forum.xda-developers.com/showthread.php?p=9575198 and http://forum.xda-developers.com/showthread.php?t=865525

What i'm looking would be a shell command like "su event_command back_ke开发者_如何学Pythony_code"


Just call:

finish();

It will kill the current activity and remove it from the stack returning the user to the previous activity. Much like the back button does.


Process process = Runtime.getRuntime().exec("sendevent /dev/input/event3 1 158 1")

158 is the value of the back button in android

something like this should work although not tested of course you need to ask for root first

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号