How to use LoaderManager in Android. Sample.

Published by Igor Khrupin on

Here is very simple example how to use LoaderManager from “” 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. Where “T” is returning type.
It can be String or complex List, Map, ets. with objects.

2014-10-23 13.53.45

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 interface for it.

	public Loader<String> onCreateLoader(int arg0, Bundle arg1) {
		return new MyLoader(getActivity(), url);

	public void onLoadFinished(Loader<String> arg0, String arg1) {
Download it from github


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.