Code example for Geocoder

Methods: getFromLocationName

0
		@Override 
		protected List<Address> doInBackground(String... params) {
			String locationName = params[0];
			Log.v(LOG_TAG, String.format("search() called: locationName=[%s]", locationName));
			List<Address> addresses = null;
	    	Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
	    	try { 
	    		addresses = geocoder.getFromLocationName(locationName, 5);
	    	} catch (IOException e) {
				Log.w(LOG_TAG, e);
			} 
			return addresses;
		} 
		 
		@Override 
		protected void onPostExecute(List<Address> result) {
			if (result != null && !result.isEmpty()) {
				adapter.setData(result);
			} 
		}