adspace


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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is the latest version of android os?

1046


What did you like better, ice cream sandwich or kitkat?

977


Which is the latest version of android?

1086


What all devices have you worked on?

1058