Advertisement
Guest User

Skobbler Map Activity

a guest
May 13th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.16 KB | None | 0 0
  1. package com.skobbler.sdkdemo.activity;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7.  
  8. import com.skobbler.ngx.map.SKMapSurfaceView;
  9. import com.skobbler.ngx.map.SKMapViewHolder;
  10. import com.skobbler.sdkdemo.R;
  11.  
  12. public class NewMapActivity extends Activity
  13. {
  14.     private SKMapSurfaceView mapView;
  15.  
  16.     @Override
  17.     protected void onCreate(Bundle savedInstanceState)
  18.     {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.activity_new_map2);
  21.  
  22.         SKMapViewHolder mapViewGroup = (SKMapViewHolder) findViewById(R.id.view_group_map);
  23.         mapView = mapViewGroup.getMapSurfaceView();
  24.  
  25.         applySettingsOnMapView();
  26.     }
  27.  
  28.     @Override
  29.     protected void onPause() {
  30.         super.onPause();
  31.         mapView.onPause();
  32.     }
  33.  
  34.     @Override
  35.     protected void onResume() {
  36.         super.onResume();
  37.         mapView.onResume();
  38.     }
  39.  
  40.  
  41.     @Override
  42.     public boolean onCreateOptionsMenu(Menu menu)
  43.     {
  44.         // Inflate the menu; this adds items to the action bar if it is present.
  45.         getMenuInflater().inflate(R.menu.menu_new_map, menu);
  46.         return true;
  47.     }
  48.  
  49.     @Override
  50.     public boolean onOptionsItemSelected(MenuItem item)
  51.     {
  52.         // Handle action bar item clicks here. The action bar will
  53.         // automatically handle clicks on the Home/Up button, so long
  54.         // as you specify a parent activity in AndroidManifest.xml.
  55.         int id = item.getItemId();
  56.  
  57.         if (id == R.id.action_settings)
  58.         {
  59.             return true;
  60.         }
  61.  
  62.         return super.onOptionsItemSelected(item);
  63.     }
  64.  
  65.     private void applySettingsOnMapView()
  66.     {
  67.         mapView.getMapSettings().setMapRotationEnabled(true);
  68.         mapView.getMapSettings().setMapZoomingEnabled(true);
  69.         mapView.getMapSettings().setMapPanningEnabled(true);
  70.         mapView.getMapSettings().setZoomWithAnchorEnabled(true);
  71.         mapView.getMapSettings().setInertiaRotatingEnabled(true);
  72.         mapView.getMapSettings().setInertiaZoomingEnabled(true);
  73.         mapView.getMapSettings().setInertiaPanningEnabled(true);
  74.     }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement