Note that there are some explanatory texts on larger screens.

plurals
  1. POThe constructor Geocoder() is undefined
    primarykey
    data
    text
    <p>I keep getting the Geocoder as being undefined with the following code. I am trying to simply get the address of a place from the lat and long. The line Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); always comes back as undifined.</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Use the LocationManager class to obtain GPS locations */ LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 600000, 1000, mlocListener); /* Class My Location Listener */ public class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { loc.getLatitude(); loc.getLongitude(); Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); currentLatitude = loc.getLatitude(); currentLongitude = loc.getLongitude(); try { List&lt;Address&gt; addresses = geocoder.getFromLocation(currentLatitude, currentLongitude, 1); if(addresses != null) { Address returnedAddress = addresses.get(0); StringBuilder strReturnedAddress = new StringBuilder("Address:\n"); for(int i=0; i&lt;returnedAddress.getMaxAddressLineIndex(); i++) { strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); } myAddress.setText(strReturnedAddress.toString()); } else{ myAddress.setText("No Address returned!"); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); myAddress.setText("Canont get Address!"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload