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