Callbackmethods of des Activity Life Cycle and the UI-Thread


Last Updated:

  1. Cocobella

    Cocobella New Member This Topic's Starter

    Joined:
    Jul 21, 2010
    Messages:
    3
    Likes Received:
    0
    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 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
  3. Cocobella

    Cocobella New Member This Topic's Starter

    Joined:
    Jul 21, 2010
    Messages:
    3
    Likes Received:
    0

Share This Page

Loading...