Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.82 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to check position with respect to lat and long
  2. Geocoder gc = new Geocoder(this, Locale.getDefault());
  3.    try {
  4.      List<Address> addresses = gc.getFromLocation(lat, lng, 1);
  5.      StringBuilder sb = new StringBuilder();
  6.      if (addresses.size() > 0) {
  7.         Address address = addresses.get(0);
  8.  
  9.         for (int i = 0; i < address.getMaxAddressLineIndex(); i++)
  10.           String addr=address.getAddressLine(i);
  11.           //use this addr string and compare . u will get the solution
  12.  
  13.      }
  14.  
  15.    } catch (IOException e) {}
  16.        
  17. Geocoder gc = new Geocoder(this, Locale.getDefault());
  18.    try {
  19.      List<Address> addresses = gc.getFromLocation(lat, lng, 1);
  20.      if (addresses.size() > 0) {
  21.         Address address = addresses.get(0);
  22.  
  23.           String state =  address.getLocality();
  24.      }
  25.  
  26.    } catch (IOException e) {}