Tell us how do you supply construction arguments into a fragment?



Tell us how do you supply construction arguments into a fragment?..

Answer / S K Nigam

To pass arguments to a Fragment when adding it to an Activity, you can use the Bundle class. First, create a new Bundle object and add your data as key-value pairs, then set this Bundle as an argument in the constructor of the Fragment or with the setArguments() method. Inside the Fragment's onCreate() method, retrieve the arguments from the Bundle using the getArguments() method.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Android OS Interview Questions

Do you know what is anr, and why does it happen?

1 Answers  


What are the steps that are involved in converting the android in newer version?

1 Answers  


What are synthetic sensors?

1 Answers  


What are three common reasons to use an intent?

1 Answers  


Name the dialog box which is supported by android?

1 Answers  


Is android oreo still supported?

1 Answers  


What are the tools placed in android sdk?

1 Answers  


Name the mobile automation tools that are available in the market.

1 Answers  


Which is the best android version?

1 Answers  


What is content provider component of android?

1 Answers  


which language is supported by android for application development?

1 Answers  


What do you understand with an activity in android?

1 Answers  


Categories