how to get the pointer/cursor location in android

前端 未结 2 1449
忘掉有多难
忘掉有多难 2021-01-15 01:10

In Android I would like to get/return the cursor location (latitude and longitude) when I click anywhere on the screen.

2条回答
  •  日久生厌
    2021-01-15 02:04

    For a location x,y on your MapView ,

    MapView    map    = (MapView) findViewById(R.id.youmapview);
    Projection proj   = map.getProjection();
    GeoPoint   latlon = proj.fromPixels(x, y);
    

提交回复
热议问题