开发者

Find out which activity started my activity?

开发者 https://www.devze.com 2023-02-17 04:19 出处:网络
I want to find 开发者_如何学JAVAout 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

I want to find 开发者_如何学JAVAout 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.


Use getCallingActivity()

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


You can use ActivityCompat.getReferrer() for this purpose.

0

精彩评论

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