Refresh a SimpleCursorAdapter after performing work on a non-UI thread

前端 未结 2 1582
旧巷少年郎
旧巷少年郎 2020-12-20 08:02

I\'m trying to call .notifyDataSetChange() on a SimpleCursorAdapter displayed in a ListView from an XML-parsing non-UI thread and can\'t for the life of me figure out how. I

2条回答
  •  执笔经年
    2020-12-20 08:38

    Create a new adapter when the query is finished and set it your listview to give a general idea below is an example of gridview change it accordingly to suit your needs

    globalAdapter = new GridImageAdapter(getApplicationContext());
    globalAdapter.notifyDataSetChanged();
    grid.setAdapter(globalAdapter);
    grid.invalidateViews();
    

提交回复
热议问题