I'm trying to make something like this: I have a mapactivity and when the user taps the map it shows the coordinates of that location. I already overrided the onclick method but it isn't even called. Any Idea?
public class MapPoint extends MapActivity implements OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mappoints);
MapView map = (MapView)findViewById(R.id.mapview);
map.setOnClickListener(this);
map.setBuiltInZoomControls(true);
map.getController().setZoom(18);
map.getController().setCenter(new GeoPoint(39735007, -8827330));
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
public void onClick(View arg0) {
Toast.makeText(this, "text", Toast.LENGTH_SHORT);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…