Reputation: 28566
What is the best place in fragment lifecycle to call REST service for example to fill ListView
with received data ? There are onCreateView
, onActivityCreated
and onResume
. My first thought was to call network service as soon as possible, so on the end onCreateView
, but i'm confused about this.
Upvotes: 1
Views: 1722
Reputation: 2430
Just don't bind REST calls to your UI. You should split up UI and business logic responsible for getting and updating data. UI is just a facade so you shouldn't try to call any network services from UI. You can implement any of the patterns described by Virgil Dobjanshi in IO Talk
Upvotes: 2