Hi all,
I made an app for android. From CoronaApplication.java (that extends android.app.Application) I need to access the onWindowFocusChanged (that belongs to Activity)
In detail, I have
public class CoronaApplication extends android.app.Application {
in which, after searching a lot on the net, I found the registerActivityLifecycleCallbacks
so I add, in the (override) onCreate the follwing code:
this.registerActivityLifecycleCallback(new ActivityLifecycleCallbacks(){ @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { Log.i("TEST", "activity Started"); }
So now I can see that the activity is started.
Now I need to know when the window lose the focus.
I need to insert the following listener in the onActivityCreated:
@Override public void onWindowFocusChanged(boolean hasFocus) { if (!hasFocus) { // Method that handles loss of window focus someMethods(); } }
how have I to insert these lines???
Thanks a lot for the reply!!!