我想将字符串地址反转为Lat和Long .

try {
                        List<Address> foundGeocode;
                       /* find the addresses  by using getFromLocationName() method with the given address*/
                        foundGeocode = new Geocoder(getActivity()).getFromLocationName(URLEncoder.encode(searchResult.getPlaces().get(position).getAddress(),"UTF-8"), 1);
                        if (!foundGeocode.isEmpty()) {
                            foundGeocode.get(0).getLatitude(); //getting latitude
                            foundGeocode.get(0).getLongitude();//getting longitude


                            if (recentSearchList != null
                                    && !recentSearchList
                                    .contains(newPlaces(searchResult.getPlaces().get(position).getId(), searchResult.getPlaces().get(position).getAddress(),
                                            searchResult.getPlaces().get(position).getName(), searchResult.getPlaces().get(position).getReference())))
                                recentSearchList.add(0, new Places(
                                        searchResult.getPlaces().get(position).getId(), searchResult.getPlaces().get(position).getAddress(),
                                        searchResult.getPlaces().get(position).getName(), searchResult.getPlaces().get(position).getReference()));

                            if (recentSearchList.size() > 5)
                                recentSearchList = new ArrayList<Places>(
                                        recentSearchList.subList(0, 5));
                            mListner.onSearchFinished(new LatLng(foundGeocode.get(0).getLatitude(), foundGeocode.get(0).getLongitude()), searchPlace.getText().toString());
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (IndexOutOfBoundsException e) {
                        e.printStackTrace();
                    }

代码工作正常 . 但是,当我试图为“EPFO,B&C Block Road Shalimar Bagh新德里德里印度”'foundGeocode.isEmpty()'做真实的地址时 . 对于具有特殊字符的地址,getFromLocationName()返回空 .