Created
June 28, 2014 18:56
-
-
Save gatlingxyz/c034245484ee7c487df6 to your computer and use it in GitHub Desktop.
AsyncTask to add views to FakeListView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class AddViewsToFakeListTask extends AsyncTask<Void, View, Void>{ | |
private ListAdapter adapter; | |
private LinearLayout view; | |
public AddViewsToFakeListTask(LinearLayout view, ListAdapter adapter){ | |
this.view = view; | |
this.adapter = adapter; | |
} | |
@Override | |
protected void onPreExecute() { | |
progress.setVisibility(View.VISIBLE); | |
} | |
@Override | |
protected Void doInBackground(Void... params) { | |
for(int i = 0; i < adapter.getCount(); i++){ | |
publishProgress(adapter.getView(i, null, null)); | |
} | |
return null; | |
} | |
@Override | |
protected void onProgressUpdate(View... values) { | |
view.addView(values[0]); | |
} | |
@Override | |
protected void onPostExecute(Void aVoid) { | |
progress.setVisibility(View.INVISIBLE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment