AsyncTaskLoader basic example. (Android)

前端 未结 6 1673
[愿得一人]
[愿得一人] 2020-12-01 02:56

I am using a Loader in my application and based on the result I get from the query I perform on COntacts using this Loader I perform some calculations and store them back in

6条回答
  •  眼角桃花
    2020-12-01 03:48

    Since Honeycomb and the v4 Compatibility Library it is possible to use AsyncTaskLoader. From what I understand, the AsyncTaskLoader can survive through config changes like screen flips. But using AsyncTask you can mess up with configuration changes.

    Key information: AsyncTaskLoader is subclass of Loader. This class performs the same function as the AsyncTask, but a bit better, it can also be useful in handling configuration changes (screen orientation).

    A very good example and explanation is given here. http://www.javacodegeeks.com/2013/01/android-loaders-versus-asynctask.html

    Google has a pretty good example directly in the API Docs. Android Design Patterns provides some more detail and the reasoning behind Loaders.

    This tutorial will definetly help You. http://www.javacodegeeks.com/2013/08/android-custom-loader-to-load-data-directly-from-sqlite-database.html

提交回复
热议问题