-4

i have list view with custom BaseAdapter, and i have menus list coming from web service and storing in SQLite database using thread(in background), so that Main Thread will not hang, and performance will increase but while setting adapter from main thread, app getting crash. throughing exception as mentioned in title of this post. how i can resolve please help.

Ashish Patel
  • 304
  • 1
  • 3
  • 11

2 Answers2

0

You Can Try Adapter.notifyDataSetChanged(); To Update Your Current List Like This >>>

List<Item> new= databaseHandler.getItems();
Adapter.clear();
Adapter.addAll(new);
Adapter.notifyDataSetChanged();
databaseHandler.close();
Ritik
  • 137
  • 1
  • 12
0

if you are using AsyncTask for background operation , do this in "onPostExecuted" method :

-> reInitialize adapter and set it to list list.setAdapter(adapter);

->And set this . adapter.notifyDataSetChanged();