Pause Android app

There are a lot of actions in my Android application. I need to perform several actions when the application resumes (the application does not work).

The Android app provides an onCreate callback, but not an onResume callback. Is there a way to identify that my application has resumed?

+5
source share
3 answers

Actions have onResume () here: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

@Override
protected void onResume() {

// ...

}

So, when your application resumes, one of your actions will resume - process it in every action.

0
source

, . Application , ( onCreate()) , ( onDestroy()).

0

, - Activity. - onResume, , , , :

As a rule, there is no need to subclass Application. In most cases, static singletones can function in a more modular way. If your singleton needs a global context (for example, to register broadcast receivers), the function to get it is to get a context that internally uses Context.getApplicationContext () when we first build the singleton.

0
source

All Articles