new GetDataTask().execute();-
private class GetDataTask extends AsyncTask<Void, Void, String[]> {
@Override
protected String[] doInBackground(Void... params) {
// Simulates a background job.
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
return mChildStrings;
}
@Override
protected void onPostExecute(String[] result) {
Map<String, String> newMap = new HashMap<String, String>();
newMap.put(KEY, "Added after refresh...");
groupData.add(newMap);
List<Map<String, String>> childList = new ArrayList<Map<String, String>>();
for (String string : mChildStrings) {
Map<String, String> childMap = new HashMap<String, String>();
childMap.put(KEY, string);
childList.add(childMap);
}
childData.add(childList);
mAdapter.notifyDataSetChanged();
// Call onRefreshComplete when the list has been refreshed.
mPullRefreshListView.onRefreshComplete();
super.onPostExecute(result);
}
}