Skip to content

Instantly share code, notes, and snippets.

@JFriel
Created May 31, 2015 10:33
Show Gist options
  • Save JFriel/8a8db905d2c3ee3ffe5e to your computer and use it in GitHub Desktop.
Save JFriel/8a8db905d2c3ee3ffe5e to your computer and use it in GitHub Desktop.
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 GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
return p1;
}
package="com.google.android.gms.location.sample.locationupdates" >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment