In the onCreate() event of an Activity, I have started an AsyncTask to retrieve Product data from a database. After this has been completed successfully, how can I update th
If you want to update the view from async after complete process in then you can use
protected void onPostExecute(String result)
{
textView.setText(result);
}
But if you want to update data while running background process then use. For ex...
protected Long doInBackground(URL... urls) {
int count = urls.length;
long totalSize = 0;
for (int i = 0; i < count; i++) {
totalSize += Downloader.downloadFile(urls[i]);
publishProgress((int) ((i / (float) count) * 100));<------
}
return totalSize;
}
protected void onProgressUpdate(Integer... progress) { <-------
setProgressPercent(progress[0]);
}
for more detail see this link Hope this will help you...!