LongClickListener

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

LongClickListener

Postby siwica » Wed Jun 24, 2009 2:20 am

Hey guys,

i was trying to add a "OnLongClickListener" to my MapView, but unfortunately I'm not able to get it work... Somehow the OnLongClickListener never gets called, does anybody know a way do manage that?!

Code: Select all
      mapView = (MapView) findViewById(R.id.mapview);
      mapView.setOnLongClickListener(new View.OnLongClickListener() {
         public boolean onLongClick(View v) {
            mapView.getController().zoomOut();
            Log.i("test","worked");
            return true;
         }
      });


Thanks,
Simon
siwica
Freshman
Freshman
 
Posts: 3
Joined: Thu Jun 18, 2009 8:33 pm

Top

Postby jpe30 » Thu Jun 25, 2009 7:12 pm

try something like this



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. mapView = (MapView) findViewById(R.id.mapview);
  3.  
  4. mapView.setOnLongClickListener(listener);
  5.  
  6.  
  7.  
  8.          private OnLongClickListener listener = new OnLongClickListener() {
  9.  
  10.          public boolean onLongClick(View v) {
  11.  
  12.             mapView.getController().zoomOut();
  13.  
  14.             Log.i("test","worked");
  15.  
  16.             return true;
  17.  
  18.          }
  19.  
  20.       };
  21.  
  22.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


The first 2 lines of code belong inside your onCreate method, and the rest remains inside your activity but outside the onCreate method.
jpe30
Freshman
Freshman
 
Posts: 4
Joined: Mon Jun 08, 2009 11:24 pm

Postby aminaz » Tue Jan 12, 2010 6:51 pm

Hello
Can i use this method when i clic on a link for a long time and i want that another frame appears ?

THnks
aminaz
Junior Developer
Junior Developer
 
Posts: 19
Joined: Thu Jan 07, 2010 5:07 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Google [Bot] and 4 guests