Android - onCreate method for an application - is it always called?

I am preparing a new version of one of my applications, and I made such huge changes in my application that I need to do some data conversion just after the application update was absolutely the first (before doing anything else). I realized that the best place for this would be in my class (which extends Application) in the onCreate () method. I tested it several times and it seems to work fine, but then I read the documentation:

The base class for those who need to maintain the global state of the application. You can provide your own implementation by specifying its name in your AndroidManifest.xml tag, [b], which will call this class will be created for you when the process for your application / package is created [/ b].

I seem to be right, but I'm not quite sure. Can you confirm / refute this?

+4
source share
5 answers

The application constructor will be called first. Then the Application :: onCreate () method is called. The only exception that I know of is that the application contains a ContentProvider, it can receive calls before the application executes.

This is from here: http://developer.android.com/reference/android/app/Application.html#onCreate ()

public void onCreate()

API 1 , , , ( ). , (, ), , , , . , super.onCreate().

+7

, . onCreate() Application. , sqllite, onUpgrade SQLiteOpenHelper. http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html

+1

, , , , : SQLiteOpenHelper.onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ). , . , , .

0

. onCreate - , . . http://developer.android.com/reference/android/app/Application.html#onCreate()

, , , - , ( ). , , , ...

, , "" . AsyncTask, .

0

No, he is an assistant professor ... you have activity A (start activity) and B ... when you start your application ... Loads starting with onCreate () ... and says that u started activity B, then it starts B and its onCreate method ... but now if you go back to A ... it will call the onResume function, not onCreate ..

-2
source

Source: https://habr.com/ru/post/1524734/


All Articles