How to use LoaderManager in Android. Sample.
Here is very simple example how to use LoaderManager from “android.support.v4.app” package.
This sample will help you create nice application which can very nice communicate with your web server.
The sample application looks like activity with ViewPager. Each Fragment in ViewPager adapter have implemented LoaderManager.LoaderCallbacks
It can be String or complex List, Map, ets. with objects.
You can run the Loader and when data is loaded then show it.
Below you can see how I use onLoadFinished method from LoaderManager.LoaderCallbacks
@Override public Loader<String> onCreateLoader(int arg0, Bundle arg1) { return new MyLoader(getActivity(), url); } @Override public void onLoadFinished(Loader<String> arg0, String arg1) { textView.setText(arg1); hideProgress(); }
0 Comments