I am using AsyncTask to load data from a SQLite Database and then providing data to a Recycler View using a StaggeredLayoutManager and CustomListAdapter.
If I don't close the cursor of doInBackground method in the onPostExecuteMethod, the transition from the previous activity is laggy, and android logcat says "Skipped 52 frames".
If I do close the cursor, at the end of the Post Execute method, the lag doesn't occur, but nothing is rendered inside the Activity. (Recycler View renders nothing.)
@Override
protected void onPostExecute(Void Void) {
c.close();
swipeRefreshLayout.setRefreshing(false);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new MyTask().execute();
}
});
swipeRefreshLayout.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
}
Aucun commentaire:
Enregistrer un commentaire