Android Activity Lifecycle
17 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which method is called before the activity is destroyed in the Activity lifecycle?

  • onDestroy() (correct)
  • onRestart()
  • onPause()
  • onResume()
  • In the lifecycle of an Activity, which method indicates that the activity is no longer visible to the user?

  • onPause()
  • onRestart()
  • onStop() (correct)
  • onCreate()
  • When can the Android runtime system kill an Activity without calling onStop() and onDestroy() methods?

  • During onPause() (correct)
  • During onCreate()
  • During onRestart()
  • During onResume()
  • Which method allows an Activity to perform setup before becoming visible to the user?

    <p>onCreate()</p> Signup and view all the answers

    In the Activity lifecycle, which method follows onResume() but precedes onDestroy()?

    <p>onPause()</p> Signup and view all the answers

    When is the onCreate method called in the Activity lifecycle?

    <p>Before the Activity is visible to the user</p> Signup and view all the answers

    In which state does an Activity have the focus of the user in the foreground?

    <p>Resumed state</p> Signup and view all the answers

    What happens to an Activity when it goes into the Paused state?

    <p>The Activity remains alive and partially visible</p> Signup and view all the answers

    Which method is called when another Activity comes to the foreground and the current Activity goes into the Paused state?

    <p>onPause method</p> Signup and view all the answers

    What happens to an Activity in the Stopped state?

    <p>The Activity is no longer visible to the user</p> Signup and view all the answers

    Which method is called when an Activity stops and relinquishes its involvement with the window manager?

    <p>onStop method</p> Signup and view all the answers

    What methods are executed when starting an Android application?

    <p>onCreate(), onResume(), onStart()</p> Signup and view all the answers

    How does an Activity retain its previous state after calling onPause() or onStop() methods?

    <p>Activity object is pushed into a stack during onStop() and pops up during onResume()</p> Signup and view all the answers

    What method is called before onDestroy() to preserve the state of an Activity?

    <p>onSaveInstanceState()</p> Signup and view all the answers

    Which callback method is executed when an Activity is just about to be destroyed?

    <p>onDestroy()</p> Signup and view all the answers

    What happens to the state of an Activity when it is destroyed using onDestroy() method?

    <p>State is preserved in a Bundle object using onSaveInstanceState()</p> Signup and view all the answers

    At what point does an Activity's state get saved in the Bundle class?

    <p>onSaveInstanceState() method before onDestroy()</p> Signup and view all the answers

    More Like This

    Android Application Development Concepts
    11 questions
    Android Activity Lifecycle
    10 questions

    Android Activity Lifecycle

    UncomplicatedAgate4014 avatar
    UncomplicatedAgate4014
    Android Studio Asosiy Qismlar
    25 questions
    Android Activity Lifecycle Quiz
    21 questions
    Use Quizgecko on...
    Browser
    Browser