Java 简单的android天气应用程序

Java 简单的android天气应用程序,java,android,location,android-location,weather,Java,Android,Location,Android Location,Weather,我正在寻找一个简单的android天气应用程序,它可以通过编程的方式在文本视图中显示温度和条件 我发现了这个: 但这太复杂了。真的,我只需要从我的位置获得两个数据 public class MainActivity extends Activity implements LocationListener{ protected LocationManager locationManager; protected LocationListener locationListener;

我正在寻找一个简单的android天气应用程序,它可以通过编程的方式在文本视图中显示温度和条件

我发现了这个:

但这太复杂了。真的,我只需要从我的位置获得两个数据

public class MainActivity extends Activity implements LocationListener{
   protected LocationManager locationManager;
   protected LocationListener locationListener;
   protected Context context;
   TextView txtLat;
   String lat;
   String provider;
   protected String latitude,longitude; 
   protected boolean gps_enabled,network_enabled;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);
     txtLat = (TextView) findViewById(R.id.textview1);

     locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
     locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
   }

   @Override
   public void onLocationChanged(Location location) {
     txtLat = (TextView) findViewById(R.id.textview1);
     txtLat.setText("Latitude:" + location.getLatitude() + ", Longitude:" +
        location.getLongitude());
   }

   @Override
   public void onProviderDisabled(String provider) {
      Log.d("Latitude","disable");
   }

   @Override
   public void onProviderEnabled(String provider) {
      Log.d("Latitude","enable");
   }

   @Override
   public void onStatusChanged(String provider, int status, Bundle extras) {
      Log.d("Latitude","status");
   }
}

有没有一种简单的方法来获取天气信息?

是的,实际上有一种更简单的方法来获取天气信息。它被称为Forecast.io。您将在那里找到api,并将能够获得访问天气的api密钥。天气将显示为json,并且很容易读取,因为有一个api可以读取它。此api提供逐分钟精确信息、7天预测和每小时预测。我更喜欢我以前制作的应用程序

它并不复杂。我同意您需要更多的信息,但是json本身应该非常小,不应该影响PerformanceEyes,我可以删除我不使用的内容,但是代码无论如何都不起作用。。我试过了,但是我犯了一些错误。所以,如果你知道一些快速获得这两个数据的方法,也许只使用两个或三个方法,你能帮我展示给我看吗?