Search code examples
androidandroid-asynctaskandroid-sqliteasynctaskloader

AsyncTaskLoader vs AsyncTask for loading single entity in Edit single entity activity?


I am studying Android. I am creating an Activity for editing single entity that loaded from local SQLite. For List of entities activity, I used AsyncTaskLoader to load list of entities. For Editing single entity activity, I don't know I should use AsyncTaskLoader OR AsyncTask to load single entity. Anyone has experience in this, please give me some advice. Thank you!


Solution

  • I would recommend going with the Loader as it will be tied to the Activity lifecycle and you won't have to worry about updating something on a dead Activity.