找出哪些活动开始了我的活动? [英] find out which activity started my activity?

查看:136
本文介绍了找出哪些活动开始了我的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找出哪个活动开始了我的活动机器人。我可以做到这一点开始使用getIntent()活动的意图,但我无法找出哪些活动开始摆在首位的意图。

i want to find out which activity started my activity in android. I can get the intent that started the activity using "getIntent()" but i am not able to find out which activity started the intent in the first place.

期待您的帮助。 预先感谢您。

looking forward to your help. thank you in advance.

推荐答案

使用<一个href="http://developer.android.com/reference/android/app/Activity.html#getCallingActivity%28%29">getCallingActivity()

注意:如果调用活动没有期待的结果(即它没有使用 startActivityForResult(意图,INT)的形式,包括:请求code),然后调用包将为null

Note: if the calling activity is not expecting a result (that is it did not use the startActivityForResult(Intent, int) form that includes a request code), then the calling package will be null

这篇关于找出哪些活动开始了我的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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