RCP2278 wrote: > First off, I apologize if this sounds like a trivial question with a > trivial answer, but I'm currently stuck at trying to get an Activity > object from ActivityManager or ComponentName. I"ve been looking at > the android developer docs to see if there are any APIs exposed that I > can use so I can get an actual Activity object given that I have an > ActivityManager or ComponentName. The best I can find so far is > grabbing the ComponentName from ActivityManager.RunningTaskInfo, get > the baseActivity (which is of type ComponentName), but then I'm stuck > there. Can anyone help?
What do you mean by "get an Activity object"? -- If you mean you want to start an Activity, I think a ComponentName can be used to construct an Intent. -- If you mean you want the actual object of an existing Activity...I don't think there is support in Android for that. Leastways, I've never seen it. -- If you mean something else, could you please clarify? Since the only Activity objects you could possibly access are your own, you could keep track of them yourself in some static HashMap or whatnot, but you'd have some bookkeeping to do to avoid garbage collection problems, handling multiple instances of the same Activity, etc. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

