Android Activity Life Cycle

Android Activity Life Cycle

No alt text provided for this image

Activity serves the entry point for the app's interaction with user.

Life cycle of an Activity is managed by the help of specific methods which defines the stages of the life cycle.

The methods are namely : onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy().

A convenient way to remember the behaviour of the Activity callback methods is to think of when they're called?relative to when the Activity is running

Case 1: Home Button Pressed

No alt text provided for this image

Case 2: Back Button Pressed

No alt text provided for this image

Case 3 : When dealing with more than one Activities.

No alt text provided for this image

Case 4: When Screen Orientation changes

No alt text provided for this image

Navigation to another Activity

No alt text provided for this image









要查看或添加评论,请登录

Apurba Gouda的更多文章

  • 5 reasons why callbacks may not be the best choice every time.

    5 reasons why callbacks may not be the best choice every time.

    1. Difficult to manage in complex applications.

  • What are the different caching mechanisms in android

    What are the different caching mechanisms in android

    Memory Cache: This is a cache that stores data in memory, making it easily and quickly accessible. It's commonly used…

  • What is compose in android?

    What is compose in android?

    Compose is a declarative UI toolkit for building native Android apps developed by Google. It allows developers to build…

    2 条评论
  • How XML UI Toolkit in android involves boilerplate code?

    How XML UI Toolkit in android involves boilerplate code?

    Defining UI elements: To create a UI element, you need to define it in an XML layout file, which involves specifying…

  • Services

    Services

    Service is one of the component of Android, runs in the background to perform long-running operations. It doesn't…

    1 条评论

社区洞察

其他会员也浏览了