Reputation: 5904
I'm looking for a simple android weather app that would show degrees and condition for example in a textview by location programmatically.
I found this one: http://www.survivingwithandroid.com/2013/05/build-weather-app-json-http-android.html?m=1
But it's too much complicated.Really, I need only two datas from my location.
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");
}
}
Is there a simple method to have the weather?
Upvotes: 1
Views: 3046
Reputation: 127
Yes, there is actually a much simpler way to get weather. It is called Forecast.io. You will find the api there, and will be able to get your api key to access the weather. The weather will be displayed as json, and is simple to read, as there is an api to read it. This api gives minute-by-minute accurate information, 7-day forecast, and hourly. I prefer it for the app I was making before
Upvotes: 1