Пример #1
0
 public void onZoomLevelChange(final int newZoomLevel) {
   // to allow changing zoom level programmatically, i.e. not just
   // by user interaction
   if (AndroidUtil.currentThreadIsUiThread()) {
     changeZoomControls(newZoomLevel);
   } else {
     this.mapView.post(
         new Runnable() {
           @Override
           public void run() {
             changeZoomControls(newZoomLevel);
           }
         });
   }
 }
Пример #2
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);
    AndroidGraphicFactory.createInstance(this.getApplication());
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
    mapView = new MapView(this);
    setContentView(this.mapView);

    mapView.setClickable(true);
    mapView.setBuiltInZoomControls(true);
    mapView.getMapZoomControls().setZoomLevelMin((byte) 17);
    mapView.getMapZoomControls().setZoomLevelMax((byte) 20);
    tileCache =
        AndroidUtil.createTileCache(
            this,
            "mapcache",
            mapView.getModel().displayModel.getTileSize(),
            1f,
            mapView.getModel().frameBufferModel.getOverdrawFactor());
  }