to get name of a location in google map by taping the location in android phone
<p>I am making an app in android to get location name in google map.i have to get the particular location name when i tap in a pariticular location in my google map.i get error when i use my code , anyone can explain why it happens!!!</p>

<pre><code>package com.android.mapadress;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.os.IBinder;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;
class MapOverlay extends com.google.android.maps.Overlay
{
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(this, 
                p.getLatitudeE6() / 1E6 + "," + 
                p.getLongitudeE6() /1E6 , 
                Toast.LENGTH_SHORT).show();
    }                            
    return false;

}

@Override
public IBinder onBind(Intent intent) {
 // TODO Auto-generated method stub
 return null;
}
}

public class mapadress extends MapActivity  {
    /** Called when the activity is first created. */
    //@Override
 private MapOverlay overlay;
    LinearLayout linearLayout;
 MapView mapView;
 MotionEvent event;

 //@Override
 protected boolean isRouteDisplayed()
 {    
  return false;
 }

    public void onCreate(Bundle savedInstanceState) {
     try
     {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mapView = (MapView) findViewById(R.id.mapview);
     mapView.setBuiltInZoomControls(true);
     overlay.onTouchEvent(event, mapView);
     }
     catch(Exception e)
     {
     }
     }

}
</code></pre>
