Wednesday, December 19, 2012

Re: [android-developers] Re: UI getting slow on video playing

In fact, the first thing I tried was the Handler approach, but it also had the same problem. Hence, I changed it to async task.


On Wed, Dec 19, 2012 at 5:52 PM, skink <pskink@gmail.com> wrote:


Shashidhar wrote:
> 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
>
>    }
>
> }
>
>
>

don't  use AsyncTask, use Handler instead

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