Get an instance of activity that starts another from intent

Is there a way to get an instance of the activity that has called the currently running activity from the intent object that has been passed to it? eg. if A has called B, I would like to retrieve A's instance from the intent in B's onCreate method. As Activity is not Serializable i am not able to pass the instance in the extras bundle. Any help on this would be great

Thanks.

Answers


It's not possible, and poses security risk, the intent can be fired by a 3rd party application and this way you get access to it.

Why do you want to do that? Just pass as Extras the variables you need, or create a reduced class to hold your data you want to transfer.


a general note on passing datan between activities: If the object you want to pass along (I guess you could write a wrapper if you can't modify the actual Class) implements Parcelable - then you can pass it between activities as well. I had to do something like this recently and I wrote a few lines on how to get going with parcelable. Hope it helps,

Cheers


Need Your Help

Is there a way I can call powershell 2.0 from MVC 4 app

powershell

I guess a better question is there a way I can call a command line from a web app?

How to make a jsonp request

javascript json angularjs

I need to do some cross site scripting. The block of code below contains the method of jsonp, the method returns as if it failed, but when I change it to be a get request I then have success. I n...