Friday 8 February 2013

What is Loaders , component, features of Loader in android


LOADERS

Interesting features

Apart from the obvoius features like ease or use and  being less error prone , the most interesting features of loaders are
  1. They monitor the source of their data and deliver new results when the content changes.
  2. They automatically reconnect to the last loader’s cursor when being recreated after a configuration change avoiding the need to re-query their data.
  3. They are available as a part of the compatibility library. So developers can use it in applications that run on android build previous to HoneyComb.

Different components involved

    • This abstract class is used to manage the different loaders that one would be using in an activity or fragment and tie the loader operations to the activity/fragment lifecycle.
    • This is a nested class that provides a callback interface to LoaderManager so that the client can interact with the load manager .
    • The following functions have to be implemented by the user.
      • onCreateLoader() : Instantiate and return a new Loader for the given ID.
      • onLoadFinished() : Called when a previously created loader has finished its load.
      • onLoaderReset() : Called when a previously created loader is being reset, thus making its data unavailable.
    • This is the base class of  any loader that asynchronously loads data. All loaders
    • Abstract loader that provides an AsyncTask to do the work. One can extend this to implement a custom loader.
    • This is an convenience class provided that could be used to query content providers and return cursor to work with. It is a subclass of AsycnTaskLoader.

1 comment:

  1. Lucky Club | Casino Site, Live Casino, LuckyJoker.live
    Lucky Club | Casino Site, Live Casino, LuckyJoker.live | Latest updates: 2021-09-01, New details luckyclub added daily.

    ReplyDelete