How do I get the instance of the currently visible activity in Android? I've read that I can get the ComponentName of the activity by using ActivityManager to get a list of tasks and messing with that, but that's a recipe for disaster.
Is there a way to get an instance of the topmost activity, or if the activity isn't mine and I can't access it, just null?