android - Get instance of current visible activity -


how instance of visible activity in android? i've read can componentname of activity using activitymanager list of tasks , messing that, that's recipe disaster.

is there way instance of topmost activity, or if activity isn't mine , can't access it, null?

to instance of visible activity, context as:

context mcontext = getapplicationcontext(); 

or

mcontext = this; 

now use activity related tasks.

or instance of activity; keep static activityclass instance somewhere else , use getter setter set instance like:

public void setactivity(myactivity activity) {          myactivity = activity;     }      public myactivity getmyactivity() {         return myactivity;     } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -