Issue
What I would like to achieve in a fragment is
- get the data from network
- from the data, check which layout I need to inflate
However, the fragment cycle seems to be a sequential flow
That means the return rootView is run before the async task finish, how to fix it ? thanks
Solution
I don't think this is a good design choice. Before you call this new fragment, in your activity, for example, you could do this checking and start a new fragment with an argument indicating the right layout. Or, you can have two diferent fragments, and start the right you. This last choice seems more elegant, since a fragment should encapsulate the layout.
Answered By - Renan Ferreira
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.