开发者

Android - Return to calling Activity

Newbie Question from an iPhone developer.

I have called the startActivity(intent) and the new activity loads. Ho开发者_开发技巧w do I go 'back' to the calling activity once a button is pushed. 'Popping' the activity off the stack basically.


If you had created the new Activity with startActivity you just need to call finish. If you had spawned the new Activity by calling startActivityForResults then you need to call setResult and then finish in order to pass back data to the onActivityResult method of the prior Activity.


Call finish() on your newly loaded activity. This is assuming you didn't call finish() on your previous activity (in which case you could always restart it).


Calling finish() closes that activity and gets back to the previous screen(or Activity which called that) , or exits the app if that is the main activity which launched app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜