Hi all,
I am using google map in my application.
Till now, I have successfully shown the map with marker, as well as *got
the clicked co-ordinates*, with the help of boolean method
*onTouchEvent*of MapOverlay extending com.google.android.maps.Overlay.

Now, I am trying to get the location name(s) of the point where I have
clicked, but *facing IOException* in that.


Here is my onTouchEvent method as follows:

@Override
    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());
    Geocoder geoCoder = new Geocoder(
            getBaseContext(), Locale.getDefault());
            try {

* List<Address> addresses = geoCoder.getFromLocation(**
p.getLatitudeE6() / 1E6,
p.getLongitudeE6() / 1E6, 1);*

            Toast.makeText(getBaseContext(), "after first line",
Toast.LENGTH_SHORT).show();

            String add = "";
            if (addresses.size() > 0)
            {
            for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();
            i++)
            add += addresses.get(0).getAddressLine(i) + "\n";
            }
            Toast.makeText(getBaseContext(), add,
Toast.LENGTH_SHORT).show();
            }
            catch (IOException e) {
                Toast.makeText(getBaseContext(), "error: "+e,
Toast.LENGTH_SHORT).show();
            e.printStackTrace();
            }
            return true;

    }
    return false;
    }

The bold line throwing the IOException. *java.io.IOException: Service not
Available*.

Please help me to get, where I am wrong, as well as some helpful suggestion
to achieve what I want.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to