Answer the question
In order to leave comments, you need to log in
How to find out why the application crashes in the android studio emulator?
private void getNotes() {
@SuppressLint("StaticFieldLeak")
class GetNotesTask extends AsyncTask<Void, Void, List<Note>> {
@Override
protected List<Note> doInBackground(Void... voids) {
return NoteDatabase.getDatabase(getApplicationContext())
.noteDao().getAllNotes();
}
@Override
protected void onPostExecute(List<Note> notes) {
super.onPostExecute(notes);
// if (noteList.size() == 0) {
// noteList.addAll(notes);
// notesAdapter.notifyDataSetChanged();
// } else {
// noteList.add(0, notes.get(0));
// notesAdapter.notifyItemInserted(0);
// }
// notesRecyclerView.smoothScrollToPosition(0);
Log.d("MY_NOTES",notes.toString());
}
}
new GetNotesTask().execute();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question