Sending Activity to background without finishing

前端 未结 5 983
臣服心动
臣服心动 2020-12-05 14:53

How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could

5条回答
  •  猫巷女王i
    2020-12-05 15:14

    Moving the task backward is NOT going to insure that you will maintain any state, unless you do that manually by responding to the Activity lifecycle events.

    You should just start the second Activity via Intent using startActivity(), or, if you need to receive a result back from the second Activity, use startActivityForResult(). This allows you to receive a callback when the user finishes the Activity and returns to your first Activity.

    Starting an Activity and getting results: http://developer.android.com/reference/android/app/Activity.html#StartingActivities

提交回复
热议问题