Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GeoPoint lnglat=getLocationFromAddress(keyword);
- System.out.println(lnglat);
- Log.d("Location Point",lnglat.toString() );
- 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;
- }
- catch(Exception e){
- e.printStackTrace();
- }
- return p1;
- }
- double lat = lnglat.getLatitude();
- double lon = lnglat.getLongitude();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement