Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Compatibility package and getLoaderManager()

Android Compatibility package is said to support LoaderManager. How can I get an instance of LoaderManager? The getLoaderManager() method is missing in FragmentActivity, it's only in Fragment class. But I want to use only Loaders, not Fragments in my app.

like image 642
fhucho Avatar asked Apr 23 '11 09:04

fhucho


People also ask

What is LoaderManager in android?

This helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle; the most common use of this is with a CursorLoader , however applications are free to write their own loaders for loading other types of data. While the LoaderManager API was introduced in Build.

How to use loaders in android?

Loader API Summary There is only one LoaderManager per activity or fragment, but a LoaderManager can manage multiple loaders. To get LoaderManager, call getSupportLoaderManager() from the activity or fragment. To start loading data from a loader, call either initLoader() or restartLoader() .

Is CursorLoader deprecated?

This class was deprecated in API level 28.

What is the importance of loader in Android programming?

Loaders are special purpose classes that manage loading and reloading updated data asynchronously in the background using AsyncTask. Introduced in Android 3.0, loaders have these characteristics: They are available to every Activity and Fragment. They provide asynchronous loading of data in the background.


1 Answers

Based on my reading of the source, call getSupportLoaderManager() on your ACL FragmentActivity.

like image 182
CommonsWare Avatar answered Oct 01 '22 21:10

CommonsWare