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开发者_C百科 the instance in the extras bundle. Any help on this would be great
Thanks.
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
精彩评论