Below is the async task I am using to update the UI
private class DisplayTask extends AsyncTask<Void, Void, Void> {
public boolean isStopped = false;
@Override
protected Void doInBackground(Void... params) {
try {
while (!isStopped) {
try {
publishProgress();
Thread.sleep(1000);
} catch(InterruptedException e) {
e.printStackTrace();
}
}
}catch(Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onProgressUpdate(Void... values) {
//Code to update UI
}
}
On Wed, Dec 19, 2012 at 5:26 PM, skink <pskink@gmail.com> wrote:
what async task?can you be more elaborate?
Shashidhar wrote:
> Hi,
> In my application, I am majorly doing 2 things.
>
> 1) some part of the screen plays video
> 2) The remaining part of screen has a set of text views and I am updating
> them every one second.
>
> For playing video, I am using surface view approach and for updating
> textviews, I am using an async task which updates UI in onprogresschanged()
> method every one second.
>
> With this approach, the textviews are not getting refreshed with the latest
> data every one second. The refresh rate is keep on changing. Some times
> they update for 10 sec etc.
>
> When I comment the video playing code, the textviews are getting updated
> every 1 sec. properly.
>
> Can any one suggest me a approach such that both the video playing and
> textview updates on UI occur properly with out any delay?
>
>
> Thanks,
> Shashidhar
pskink
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
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 post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment