如何在 Android 中将 Swingworker 更改为 AsyncTask?
我的代码如下。
private void showWeather() {
// TODO Auto-generated method stub
SwingWorker worker = new SwingWorker<WeatherInfo,Object>()
{
public WeatherInfo doInBackground()
{
YahooWeather yahooWeather = new YahooWeather();
return yahooWeather.getWeatherInfo();
}
public void done()
{
try {
WeatherInfo wInfo = get(); // get WeatherInfo result from background thread
updateGUI(wInfo);
}
catch(Exception e){}
}
};
worker.execute();
}
最佳答案
您应该使用AsyncTask相反
关于java - 如何在 Android 中将 Swingworker 更改为 AsyncTask?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6545817/