从
QueryYahooWeather方法中删除所有Toast的from,因为此方法是从
doInBackground(Object...params)of 调用的,
AsyncTask并且您无法从后台线程访问Toast等Ui元素(也是Ui元素)。
注意:
如果您想知道后台发生了什么,请使用Log代替Toast的
编辑:
将doInBackground更改为:
@Overrideprotected String doInBackground(Object... params) { // TODO Auto-generated method stub String strresult=""; try { Log.i("my label", "entering in doInBackground"); Log.i("params[0]", params[0].toString()); strresult= QueryYahooWeather(params[0].toString()); Log.i("strresult result ::: ", strresult); } catch (Exception e) { Log.i("my label", e.toString()); return null; } return strresult;}


