La mejor manera de encontrar la actualización meteorológica de la ubicación actual en Android
Frecuentes
Visto 809 veces
1 Respuestas
2
Lokesh
If you already know how to how to find your location's name (city or area) from GPS, just try my example here:
https://github.com/zh-wang/YWeatherGetter4a .
You just need a city name or area name to get its current weather.
If you do not know it, check the following code
Geocoder gcd = new Geocoder(context, Locale.ENGLISH);
List<Address> addresses = null;
try {
addresses = gcd.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String cityName = "";
if (addresses != null && addresses.size() > 0) {
Out.d("Found city: ", addresses.get(0).getLocality());
cityName = addresses.get(0).getLocality();
}
Best Regards, Zhenghong Wang
Respondido el 14 de Septiembre de 12 a las 09:09
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android weather or haz tu propia pregunta.
What is "location" here? How about I don't know my location? I mean I used your library in yahoo weather and it can't find city name by wifi. could you help me? - namikaze minato