Last active
July 4, 2018 10:22
-
-
Save paulfranco/d8728e523db988966681ab92011947dc to your computer and use it in GitHub Desktop.
Android Fragment Life Cycle Questions.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Which lifecycle method should we use if we want to do some work in our Fragment immediately after the Activity has been all setup. | |
Answer: onActivityCreated | |
2. Which lifecycle method is called when a Fragment is disassociated from its Activity. | |
Answer: onDetach | |
3. Fragments have all the same lifecycle methods as an Activity as well as five lifecycle methods of their own. | |
Answer: True | |
4. Which is the very first Fragment lifecycle method to be called when adding a Fragment for the first time? | |
Answer: onAttach | |
5. The Fragment back stack is just a list of FragmentTransactions. | |
Answer: True | |
6. What method do we use to add a FragmentTransaction to the back stack? | |
Answer: addToBackStack | |
7. Which method can we use to go back to a previous named back stack entry? | |
Answer: popBackStack(String name) | |
8. If your Activity is extending AppCompatActivity, which FragmentManager would be the best choice? | |
Answer: SupportFragmentManager | |
9. addToBackStack(String name) can be called with a null name. | |
Answer: True | |
10. When dealing with Fragments within Fragments which fragment manager should we use? | |
Answer: ChildFragmentManager | |
11. ViewPagers have tabs at the top by default. | |
Answer: False | |
12. How can data be passed from an Activity to a Fragment? | |
Answer: There are two ways: 1. Using the Bundle Object 2. Using the Fragment Object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment