说我有2个活动(ActivityOne和ActivityTwo)。我怎么会叫ActivityTwo从ActivityOne?那么,我怎么会回到ActivityOne从ActivityTwo?例如,我有所有的主机手机上的联系人列表视图。当我点击一个联系人,另一个活动显示信息,并允许该联系人的编辑。然后,我可以打后退按钮,我会回去的确切状态ActivityOne在之前我叫ActivityTwo。我在想一个Intent对象,但我不知道。可能有人张贴一些code?
Say I have 2 activities (ActivityOne and ActivityTwo). How would I call ActivityTwo from ActivityOne? Then how would I return to ActivityOne from ActivityTwo? For example, I have a listview with all the contacts on the host phone. When I tap on a contact, another activity shows information and allows editing of that contact. Then I could hit the back button, and I would go back to the exact state that ActivityOne was in before I called ActivityTwo. I was thinking an Intent object, but I am not sure. Could someone post some code?
推荐答案在你的第一个活动(AcitvityOne),你可以调用
In your first activity (AcitvityOne) you could call
Intent intent = new Intent(this, ActivityTwo.class); startActivityForResult(intent, CODE);
然后你可以重写
Then you can override
public void onActivityResult(int reqCode, int resultCode, Intent data) {要获得这个活动的结果。
to receive the result of this activity
更多推荐
调用其他活动活动?
发布评论