Code example for Geocoder

Methods: getFromLocationName

2
    } 
 
    /** Return List of <Address> from searched location */ 
    public static List<Address> geoDecode(String searchedLocation) {
        try { 
            Geocoder geo = new Geocoder(XmppService.getInstance().getBaseContext(), Locale.getDefault());
            List<Address> addresses = geo.getFromLocationName(searchedLocation, 10);
            if (addresses != null && addresses.size() > 0) {
               return addresses;
            } 
        } 
        catch(Exception ex) {
        } 
 
        return null; 
    } 
 
    /** launches an activity on the url */ 
    public static void launchExternal(String url) {
        Intent popup = new Intent(XmppService.getInstance(), GeoPopup.class);
Experience pair programming with AI  Get Codota for Java