2013-03-31 4 views
0

GDActivity로 작동 확인 : 나는 "활동"을 "GDActivity"와 "된 setContentView"을 "setActionBarContentView"를 변경할 때이 활동은 내가이 활동이

package zh.wang.android.yweathergetter; 

import greendroid.app.GDActivity; 
import zh.wang.android.utils.YahooWeather4a.WeatherInfo; 
import zh.wang.android.utils.YahooWeather4a.YahooWeatherInfoListener; 
import zh.wang.android.utils.YahooWeather4a.YahooWeatherUtils; 
import android.app.Activity; 
import android.os.Bundle; 
import android.widget.TextView; 

public class MainActivity extends Activity implements YahooWeatherInfoListener { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     YahooWeatherUtils yahooWeatherUtils = YahooWeatherUtils.getInstance(); 
     yahooWeatherUtils.queryYahooWeather(getApplicationContext(), "Madrid", this); 
    } 

    @Override 
    public void gotWeatherInfo(WeatherInfo weatherInfo) { 
     // TODO Auto-generated method stub 
     if(weatherInfo != null) { 
      TextView tv = (TextView) findViewById(R.id.textview_weather_info); 
      tv.setText(weatherInfo.getTitle() + "\n" 
        + weatherInfo.getLocationCity() + ", " 
        + weatherInfo.getLocationCountry() + "\n" 
        + "Climatología: " + weatherInfo.getCurrentText() + "\n" 
        + "Temperatura actual: " + weatherInfo.getCurrentTempC() + "ºC"+ "\n" 
        + "Previsión para mañana: " + weatherInfo.getForecast1Text() + "\n" 
        + "Previsión para pasado mañana: " + weatherInfo.getForecast2Text()); 
     } 
    } 

} 

나는 또한 GD 라이브러리를 설정,하지만 내를 앱 ForceCloses. 영어로 죄송합니다.

+0

우리는 logcat 출력이 필요합니다. 우리를 위해 게시하십시오. – WELLCZECH

답변

0

YWeatherGetter4a lib의 최신 버전을 사용하고 있습니까? 그렇지 않으면 AsyncTask 클래스를 사용하여 textview의 텍스트를 다른 스레드에서 설정해야합니다.

관련 문제