How is it right to release evaporative data on the listview, cardview, list?
-
There's a set of hard data.
ArrayList<String> strings
which we get through some web page. Parsing is naturally taking place in a separate flow, but when I try to get these data out of here,cardview
or simplylistview
No data come. The data will only be decorated if you can force the main flow to wait for the side. There you go.try { strings = stringsTask.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); }
How can you avoid such a design? I'm guessing we need to go to school.
onPostExecute()
I don't know what. As indicated thereMainActivity.adapter.notifyDataSetChanged();
not working (i.e. after full download of all data, data are still not updated). I tried to explain my problem, but if I couldn't, please write about it.
-
- Don't do an adapter with a static field.
- Your data come as an argument. That's what you need to do with them,
- Get him.
ListView
orRecyclerView
or something. - Now you can call.
notifyDataSetChanged()
above the adapter.