android loader demo 实例
效果图:
-
AppActivity 加载系统 app
-
SmsActivity 加载系统短信
-
SmsActivity 加载系统断线
功能是一样的,都是读取系统短信。
SmsActivity 的 Loader 是基于 AsyncTaskLoader<Cursor>.
SmsActivity2 的 Loader 是基于 CursorLoader 。用 CursorLoader 的好处是当 系统短信发生变化的时候,内部会使用观察者模式,重新加载数据。并且调用 onLoadFinished 方法。