Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid:how to get lat and long into my adapter
    primarykey
    data
    text
    <p>I want to get latitude and longitude of a place when i enter my address. i have one activity with programatically created custom dailog, this has the address feilds, when i type my address i need to get the latitude and logitude. below is my adapter code where i am trying to get the lat and lng details</p> <pre><code> public void performAction(View v, final Activity activity) { Context myContext = v.getContext(); PopUpMenu popUpMenu = (PopUpMenu) v.getTag(); String result = popUpMenu.getMenuName(); if (result != null &amp;&amp; result.equalsIgnoreCase(myContext.getResources().getString( R.string.addnewplace))) { AttractionData attractionData = new AttractionData(); createDiloag(attractionData,activity.getResources().getString(R.string.addnewplace)); setgpsLocation(); } public void setgpsLocation() { final EditText address = new EditText(this.activity); String addressText = address.getText().toString(); try { final StringBuffer myAddress = new StringBuffer(); if(addressText!=null&amp;&amp;!addressText.trim().equals("")){ myAddress.append(addressText); } Geocoder gcd = new Geocoder(parentActivity, Locale.getDefault()); List&lt;Address&gt; addresses = gcd.getFromLocationName(addressText, 5); if (addressList != null &amp;&amp; addressList.size() &gt; 0) { Address location = addressList.get(0); location.getLatitude(); location.getLongitude(); // int lat = (int) (addressList.get(0).getLatitude() * 1e6); // int lng = (int) (addressList.get(0).getLongitude() * 1e6); AttractionData attractionData = new AttractionData(); attractionData.setLatitude(location.getLatitude()); attractionData.setLongitude( location.getLongitude()); } catch (Exception e) { Log.e(TAG, "Error", e); } } </code></pre> <p>I am unable to get the lat lng details, Any help is appreciated.</p>
    singulars
    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.
 

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