La mejor manera de encontrar la actualización meteorológica de la ubicación actual en Android

What is the Best way to findout the weather Updates of my current location. Is there any good articles to follow. I have just tried this aquí. But it wont work for me. Please provide good article or sample. Thanks in advance..

preguntado el 28 de agosto de 12 a las 11:08

1 Respuestas

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

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

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.