Stay organized with collections Save and categorize content based on your preferences.

Introduction to the Navigation component

  1. True or False: onCreateView() is only called once for a fragment’s entire lifecycle.
  2. Which of the following is a benefit of using fragments?
  3. In the fragment lifecycle, which of the following tasks should be performed in onViewCreated()?

    Choose as many answers as you see fit.

  4. In the fragment lifecycle, which of the following tasks should be performed in onCreateView()?
  5. Fill-in-the-blanks

    Enter one or more words to complete the sentence.

    The ___ method needs to be overridden in the host activity to ensure your app’s fragment-based navigation responds to the app’s "Up" button.

  6. Given the code for navigating between two fragments in a note-taking app, a list of books and a list of notes, which of the following is true about the navigation graph file?
    val action = BooksListFragmentsDirections.actionBooksListToNotesList(bookIndex = index)
    holder.view.findNavController().navigate(action)