Android: why i get these AsyncTask Error?

只愿长相守 提交于 2019-12-03 15:56:56

You should start AsyncTask with a Handler created on main thread. So replace your run() method in IceCastPoll with this one:

private Handler handler = new Handler(Looper.getMainLooper());

@Override
public void run() {
   handler.post(new Runnable() {
      public void run() {
          new AsyncTaskProc().execute();
      }
   });
 }
 new AsyncTaskProc().execute();    

Dont put this code inside a thread .

Because it is already a Handler.

Simple Execute the code where ever you need like new AsyncTaskProc().execute(); its enough my Friend

One Quick suggestion in your code: Why are you doing findViewById() every time, because you are trying to execute AsyncTask at particular interval, so its not feasible way to do it every time.

Instead, find all those views inside onCreate() method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!