简体   繁体   中英

How can I differentiate an android Activity from a SubActivity programatically?

How can I differentiate an android Activity from a SubActivity programmatically? Is there any API for that?

I am assuming you are referring to detecting whether an activity was started via startActivityForResult() or not.

In that case, try getCallingActivity() . To quote the documentation , "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."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM