I wanted to know the questions below:
- When to use onCreateView () vs onActivityCreated ()?
- Which of these two methods should I use to populate a listView with adapter?
I wanted to know the questions below:
- When to use onCreateView () vs onActivityCreated ()?
- Which of these two methods should I use to populate a listView with adapter?
onCreateView () is used when you want to create a custom Fragment . Caution, if you use it to create a view, you later need to destroy this object by calling onDestroyView () . It is always executed before onActivityCreated () .
OnActivityCreated () is called after the previous one informing you that a Fragment View was instantiated.
On what to use to populate a ListView, use onCreateView () because onActivityCreated () is more to retrieve the state of objects already created.
This last description did not test!