1

I'm creating an App with 3 different activities:

  • MainActivity (Root activity to start ActivtyA and ActivtyB)
  • ActivtyA
  • ActivtyB

ActivtyA can start a new intent of itself with different viewcontent to be loaded with the following flow:

 MainActivity  -->  ActivtyA (Content 1)   -->  ActivtyA (Content 2)

Now i want the user to be directed to MainActivity if he presses the "UP" button in the actionbar and to be directed to ActivtyA (Content 1) if he presses the "BACK" button.

I don't want to use NavUtils.navigateUpFromSameTask(this); because of its weird behaviour on Jelly Bean and also i can't solely rely on the parentActivity flag inside my AndroidManifest, because i have to support backward Android Honeycomb 3.0. Is there any good solution for my problem?

4

1 回答 1

1

后退按钮的实现很简单,只需调用finish()

对于向上按钮的实现,您可以开始MainActivity 使用标志FLAG_ACTIVITY_CLEAR_TOP

于 2013-07-01T15:29:48.600 回答