I update my activity's data with a Async task. it works on all the devices
till date, but in Android 4.2.2 KitKat AsyncTask's onProgressUpdate method
is not working.
Below is reference code of AsyncTask
class MyAsync extends AsyncTask<String, String, String>{
boolean flag = true;
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
while(flag)
{
// do background Task
//publishProgress
publishProgress("");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
@Override
protected void onProgressUpdate(String... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
//Update UI
}}
And this code how i Start AsyncTask
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,AsyncTask.SERIAL_EXECUTOR);
else
asyncTask.execute(params);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.