Question

1. Please check all of the traits that make fragments useful. They are reusable They can...

1. Please check all of the traits that make fragments useful.

  1. They are reusable
  2. They can be used to build a flexible UI
  3. Fragments have the same lifecycle as their host activity
  4. You can dynamically add or remove them during runtime
  5. All of the above

2. What is the right sequence in order to dynamically display a fragment.

For example, to start a new activity: A) Create a new Intent that points to the new activity, B) Add any information you want to that Intent, C) Start the intent. The right sequence is ABC.

A- Create a new fragment instance in a host activity

B- Create a new fragment class that inflates a layout

C- Create a layout that defines the appearance of the fragment

D- Add the fragment to it's host activity using the FragmentManager and a fragment transaction

  1. ABDC
  2. ADBC
  3. CBAD
  4. DACB
  5. DCBA

3. Which callback method is called when the Fragment’s user interface becomes visible but is not yet active?

  1. onCreateView()
  2. onStart()
  3. onPause()
  4. onResume()
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. We can use multiple fragments in a single activity to build a flexible UI and also reuse those fragments in multiple activities. A fragment has its own life cycle and we can add or remove it while the activity is still running.

So, the correct options are A,B and D.

2. The correct sequence is

  • Create a layout that defines the appearance of the fragment
  • Create a new fragment class that inflates a layout
  • Create a new fragment instance in a host activity
  • Add the fragment to it's host activity using the FragmentManager and a fragment transaction

Hence the correct option is (C) CBAD

3. The onStart( ) method is called when the Fragment’s user interface becomes visible but is not yet active.

Let me know if you have any doubts in the comments. Please upvote if the answer helped you.

Add a comment
Know the answer?
Add Answer to:
1. Please check all of the traits that make fragments useful. They are reusable They can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT