Question: I want to show the location of an address in Google Maps.

How do I get the latitude and longitude of an address using the Google Maps API?

Answer: 
This is how you can find the latitude and longitude of where we have click on map. 

```
public boolean onTouchEvent(MotionEvent event, MapView mapView) 
{   
    //---when user lifts his finger---
    if (event.getAction() == 1) 
    {                
        GeoPoint p = mapView.getProjection().fromPixels(
            (int) event.getX(),
            (int) event.getY());

        Toast.makeText(getBaseContext(), 
             p.getLatitudeE6() / 1E6 + "," + 
             p.getLongitudeE6() /1E6 , 
             Toast.LENGTH_SHORT).show();
    }                            
    return false;
} 

```

it works well.

To get the location's address we can use geocoder class.
```
public LatLang getLatLangFromAddress(String strAddress){
    Geocoder coder = new Geocoder(this, Locale.getDefault());
    List<Address> address;
    try {
        address = coder.getFromLocationName(strAddress,5);
        if (address == null) {
                return new LatLang(-10000, -10000);
            }
            Address location = address.get(0);
            return new LatLang(location.getLatitude(), location.getLongitude());
        } catch (IOException e) {
            return new LatLang(-10000, -10000);
        }
    }            

```

`LatLang` is a pojo class in this case.

`<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />` permission is not required.