当用户在我的活动中按下后退硬件按钮时,他将被带到上一个活动或主屏幕(取决于他首先如何进入该活动)。有没有办法确定用户在onBackPressed
方法内部的确切位置?
问问题
36 次
1 回答
2
In your home and previous activity when you start the intent to go to this activity, you can add an extra to the Intent.
Intent.setExtra("PREVIOUS_ACTIVITY ", "HOME")
Then you can check in your activity onBackPressed() if it came from the home or another activity.
于 2015-04-19T14:39:54.303 回答