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.
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.
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() .
This class was deprecated in API level 28.
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.
Based on my reading of the source, call getSupportLoaderManager()
on your ACL FragmentActivity
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With