• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i change swingworker to AsyncTask of android

 
tawisak ruksuwan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my code

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();
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic