Domanda

There are lifecycle callback methods in android. A callback method is defined as a method which is passed as an argument to another so that it can be called later.

  1. Why are lifecycle methods (e.g. lifecycle methods of an activity) called as callback methods.

  2. In android and so the sequence in which the program runs is in the hands of the user, i.e. when the user clicks on the launcher icon of an application, its onCreate() lifecycle callback method is called. Likewise onPause(), onStop(), onResume() etc. are called in response to user's actions.

Does the system call (invoke) the onCreate() when the user touches the launcher icon, or does the program calls it?

È stato utile?

Soluzione

The term callback describes the mechanism used by android to handle events.These methods are declared by the app and then the app goes about with other things. At the appropriate moment, that is when the event happens the android system calls back into the app's code and executes it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top