1. Download our Official Android App: Forums for Android!

Apps Callbackmethods of des Activity Life Cycle and the UI-Thread

Discussion in 'Android Development' started by Cocobella, Aug 6, 2010.

  1. Cocobella

    Cocobella Guest
    Thread Starter
    Rank:
    None
    Posts:
    0
    Joined:

    Hallo,

    I'm struggling with the Life Cycle of activities. Ok, with the help of the callback methods onCreate(), on Start(), onResume(), onPause(),..., onDestroy() you are able to react to state changes in your activity by overwriting them. Well, as far as I understand this issue, those methods are called by the UI thread of the application (also calles main thread) in which the activity is running. Is that right?

    But who advises the UI thread when to call those callback methods? Or does he manage them on his own? I think the OS has to catch the events caused by the user oder arised in the sytem that lead to a state change of my activity. And then it has to convey them in any kind to the UI thread. Or?
    E.g. pushing the home button while the activity is in the state runnning/active causes the call of onPause() and then onStop(). Is there something like a Message or a Runnable object that is put into the MessageQueue of the UI thread? Or how does the notification mechanism look like?
    Could somebody explain how this works?

    Thanks for your help
     

    Advertisement

  2. cp1

    cp1 Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    375
    Joined:
    Apr 30, 2010

    Apr 30, 2010
    375
    35
    53
  3. Cocobella

    Cocobella Guest
    Thread Starter
    Rank:
    None
    Posts:
    0
    Joined:

Share This Page

Loading...