0

If I want to simulate press on home button I do this

Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);

But how can I simulate long press?

4

1 回答 1

0

您不能覆盖主页按钮。出于安全原因,Android 不允许这样做。但是要处理长按按钮,您可以使用onKeyLongPress

于 2011-08-03T09:10:18.977 回答