Java Code Examples for com.google.android.gms.maps.model.CameraPosition#fromLatLngZoom()
The following examples show how to use
com.google.android.gms.maps.model.CameraPosition#fromLatLngZoom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaceOnAMapDialog.java From narrate-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getIntent().getExtras(); this.title = args.getString("title", null); this.location = args.getParcelable("location"); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); setContentView(R.layout.dialog_place_on_a_map); TextView textViewTitle = (TextView) findViewById(R.id.dialog_title); if (this.title != null) textViewTitle.setText(this.title); else textViewTitle.setText(location.latitude + ", " + location.longitude); try { MapsInitializer.initialize(this); } catch (Exception e) { e.printStackTrace(); } map = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); map.getUiSettings().setScrollGesturesEnabled(false); map.getUiSettings().setZoomGesturesEnabled(false); map.getUiSettings().setRotateGesturesEnabled(false); map.addMarker(new MarkerOptions() .position(location)); CameraPosition newPosition = CameraPosition.fromLatLngZoom(location, 12.0f); map.moveCamera(CameraUpdateFactory.newCameraPosition(newPosition)); }
Example 2
Source File: LocationPickerDialog.java From narrate-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.location_picker_dialog); getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); try { MapsInitializer.initialize(this); } catch (Exception e) { e.printStackTrace(); } mMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); mMap.setMyLocationEnabled(true); if ( getIntent().getParcelableExtra("location") != null ) { final CameraPosition newPosition = CameraPosition.fromLatLngZoom((LatLng) getIntent().getParcelableExtra("location"), 15); mHandler.postDelayed(new Runnable() { @Override public void run() { mMap.animateCamera(CameraUpdateFactory.newCameraPosition(newPosition)); } }, 500); } findViewById(R.id.save).setOnClickListener(this); findViewById(R.id.cancel).setOnClickListener(this); }