I am developing an android application and in that application, I want to search for places on a map without using places.api. is there a way to get LatLng from a given address?
Asked
Active
Viewed 53 times
1 Answers
0
You can get address from Latng by using Geocoder,please check below code
public GeoPoint getLocationFromAddress(String strAddress){
Geocoder coder = new Geocoder(this);
List<Address> address;
GeoPoint p1 = null;
try {
address = coder.getFromLocationName(strAddress,5);
if (address==null) {
return null;
}
Address location=address.get(0);
location.getLatitude();
location.getLongitude();
p1 = new G`enter code here`eoPoint((double) (location.getLatitude() * 1E6),
(double) (location.getLongitude() * 1E6));
return p1;
}
}

Emad Seliem
- 608
- 1
- 4
- 5
-
Hey @Emad thank u soo much for helping out. can you please tell me how to check for invalid entry of address? – Sab Sep 09 '19 at 16:54