MapView OnClickListener got no response.

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

MapView OnClickListener got no response.

Postby thl16888 » Sat Dec 27, 2008 7:27 am

hi everyone
MapView OnClickListener got no response. The source code is as
below. Would you like to give me a hand how to solve it? Thank you in
advance.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void onCreate(Bundle savedInstanceState) {
  2.  
  3.         super.onCreate(savedInstanceState);
  4.  
  5.         setContentView(R.layout.main);
  6.  
  7.         mMapView = (MapView) findViewById(R.id.mapview1);
  8.  
  9.         mMapView.setClickable(true);
  10.  
  11.         mMapView.setOnClickListener(new OnClickListener(){
  12.  
  13.             public void onClick(View view) {
  14.  
  15.                 Log.d("Test","Android map view on click
  16.  
  17. listener.......");
  18.  
  19.  
  20.  
  21.  
  22.  
  23.             }
  24.  
  25.         });
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
thl16888
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Nov 04, 2008 2:18 pm

Top

Postby dmt » Thu Jan 08, 2009 1:50 am

Did you first try making the view clickable (using .setClickable(true)) ?

Otherwise, if ur using a MyLocationOverlay to track your mobile device on the map, you can simply override its 'onTap(GeoPoint p, MapView m)' method and place your code in there.
User avatar
dmt
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Jan 05, 2009 6:06 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests