Created
May 31, 2015 10:33
-
-
Save JFriel/8a8db905d2c3ee3ffe5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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