Can't create handler inside thread that has not called Looper.prepare() Android

后端 未结 2 390
轮回少年
轮回少年 2020-12-21 22:50

I am using AsyncTask to call yahooweather API. Following is the code:


public class myactivity extends Activity {
    final String yahooapisBase = \"http:         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 23:03

    you are calling

    Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG)
                .show();
    

    in QueryYahooWeather which is being called in doInBackground.

    You can not call UI calls from background thread.

提交回复
热议问题