获取意图对象的活动 [英] Get the intent object in an activity

查看:110
本文介绍了获取意图对象的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是该方案。
1.我的应用程序有2个活动。
2.活动-1创建一个意图对象,并通过这个意图给startActivity方法来启动活动-2
3.在startActivity方法活动-1得到的onPause。

Following is the scenario. 1. My application has 2 activities. 2. Activity-1 creates an intent object and pass this intent to startActivity method to launch Activity-2 3. After startActivity method Activity-1 gets onPause.

我在这里的问题是,我可以得到我的onPause方法相同意向对象未做意向对象我的类,即中的一部分,我知道Android提供的API来获取其用于​​启动该活动的意图。这意味着我能得到这个意图对象活动-2,但我可以让它在活动-1还后,我使用的功能startActivity。

My question here is that can i get the same intent object in my onPause method without making intent object a part of my class i.e. I know android provides API to get the intent which is used to launch the activity. That means i can get this intent object in Activity-2 but can i get it in Activity-1 also after i used the function startActivity.

谢谢
Dalvin

Thanks Dalvin

推荐答案

借助的onPause 方法没有参数。因此,所有的对象,它会在绝操作要么是类成员或属于一个全局/静态对象

The onPause method has no arguments. Therefore all objects that it will operate on must either be class members or belong to a global/static object.

是否有你不希望这是你的类的一部分的原因是什么?这将是处理这种情况的最简单,最正确的方法。

Is there a reason that you don't want this to be a part of your class? This will be the easiest and proper way to handle the situation.

这篇关于获取意图对象的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆