Prevent Scrolling of MapView

Tutorials that use the MapActivity. Many using GPS functionality.

Postby com2usprav » Sun Apr 13, 2008 7:12 pm

Hi ,

I ve found a way to stop the scrolling in the map . The code given bleow will do it . Extend the Mapview class and override the despatchMotion event Method.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.google.android.maps;
  2.  
  3.  
  4.  
  5. import android.content.Context;
  6.  
  7. import com.google.googlenav.map.Map;
  8.  
  9. import com.google.googlenav.map.TrafficService;
  10.  
  11.  
  12.  
  13. import android.view.KeyEvent;
  14.  
  15. import android.view.MotionEvent;
  16.  
  17.  
  18.  
  19. public class MyMapView extends MapView {
  20.  
  21.        
  22.  
  23.     public MyMapView(Context context) {
  24.  
  25.         super(context);
  26.  
  27.     }
  28.  
  29.  
  30.  
  31.     void setup(Map map, TrafficService traffic) {
  32.  
  33.         mMap = map;
  34.  
  35.         super.setup(map, traffic);
  36.  
  37.     }
  38.  
  39.  
  40.  
  41.     public Map getMap() {
  42.  
  43.         return mMap;
  44.  
  45.     }
  46.  
  47.  
  48.  
  49.     private Map mMap;
  50.  
  51.     public boolean dispatchMotionEvent(MotionEvent e) {        
  52.  
  53.        return false;
  54.  
  55.     }
  56.  
  57. }
  58.  
  59.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4





Happy Coding !
Pravin Kumar
User avatar
com2usprav
Developer
Developer
 
Posts: 26
Joined: Sat Mar 29, 2008 3:28 pm
Location: Bangalore

Top

Postby a.fisher » Tue Oct 27, 2009 6:49 pm

com2usprav wrote:Hi ,

I ve found a way to stop the scrolling in the map . The code given bleow will do it . Extend the Mapview class and override the despatchMotion event Method.



It doesn't work mate
a.fisher
Freshman
Freshman
 
Posts: 5
Joined: Wed Oct 14, 2009 10:23 am

Top

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests