There is a certain set of string data ArrayList<String> strings , which we obtain by parsing some web page. Parsing naturally occurs in a separate thread, but when I try to output this data to a cardview or just a listview using an adapter, no data comes. The data will be displayed only if you forcefully ask the main thread to wait for the side thread to be executed. Like this:
try { strings = stringsTask.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } How can you avoid such a design? I assume that you need to onPostExecute() something in the onPostExecute() task, but I do not know what. The specified MainActivity.adapter.notifyDataSetChanged(); does not work (i.e., after all data is fully loaded, the data is still not updated). I tried to clearly explain my problem, but if I failed, please write about it.