调用其他活动活动?

编程入门 行业动态 更新时间:2024-10-24 01:55:36
本文介绍了调用其他活动活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

说我有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

更多推荐

调用其他活动活动?

本文发布于:2023-11-27 03:56:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636480.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!