Java 类com.google.android.gms.maps.MapFragment 实例源码
项目:NSW-Petrol-Prices
文件:DashboardActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: 20-Nov-16 inject this into presenter
generator = new IconGenerator(this);
generator.setContentRotation(270);
generator.setStyle(IconGenerator.STYLE_BLUE);
mapFragment = ((MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment));
mapFragment.getMapAsync(googleMap -> {
map = googleMap;
presenter.onMapReady();
map.setMyLocationEnabled(true);
});
presenter.onAttach();
}
项目:Team9Project
文件:GeolocationActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!isNetworkAvailable(this)) {
startNetworkUnavailableDialog();
}
setContentView(R.layout.activity_geolocation);
map = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
Intent intent = getIntent();
Geolocation location = (Geolocation) intent.getSerializableExtra(EXTRA_LOCATION);
LatLng mapPosition = new LatLng(location.getLatitude(), location.getLongitude());
marker = map.addMarker(new MarkerOptions().position(mapPosition));
map.animateCamera(CameraUpdateFactory.newLatLng(mapPosition));
map.setOnMapClickListener(new OnMapClickListener() {
@Override
public void onMapClick(LatLng point) {
marker.setPosition(point);
map.animateCamera(CameraUpdateFactory.newLatLng(point));
}
});
}
项目:quake-alert-android-app
文件:MapsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
String themes = sharedPrefs.getString(
getString(R.string.settings_themes_key),
getString(R.string.settings_themes_default));
switch (themes) {
case "dark":
setTheme(R.style.AppTheme);
break;
case "light":
setTheme(R.style.AppTheme_Light);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
LoaderManager loaderManager = getLoaderManager();
loaderManager.initLoader(0, null, this);
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
项目:Guanajoven
文件:DetalleRegionFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_detalle_region, container, false);
region = realm.where(Region.class).equalTo(getString(R.string.fragment_detalle_region_idregion), getArguments().getInt(ID_REGION)).findFirst();
mapaRegion = (MapFragment) getActivity().getFragmentManager().findFragmentById(R.id.mapa_region);
mapaRegion.getMapAsync(this);
tvNombreRegion = (TextView) v.findViewById(R.id.tv_nombre_region);
tvDireccionRegion = (TextView) v.findViewById(R.id.tv_direccion_region);
tvResponsableRegion = (TextView) v.findViewById(R.id.tv_responsable_region);
tvDescripcionRegion = (TextView) v.findViewById(R.id.tv_descripcion_region);
tvNombreRegion.setText(region.getNombre());
tvDireccionRegion.setText(region.getDireccion());
tvResponsableRegion.setText(region.getResponsable());
tvDescripcionRegion.setText(region.getDescripcion());
return v;
}
项目:Mobility-Profile
文件:YourPlaceActivity.java
private void initializeViewElements() {
name = (TextView) findViewById(R.id.place_name);
address = (TextView) findViewById(R.id.place_address);
editButton = (Button) findViewById(R.id.place_edit_button);
deleteButton = (Button) findViewById(R.id.place_delete_button);
back = (ImageButton) findViewById(R.id.place_back_button);
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
fancifyNameAndAddress();
editButtonListener();
deleteButtonListener();
backButtonListener();
mapFragment.getMapAsync(this);
}
项目:TWD97_change_to_WGS
文件:ParkingMain.java
@Override
public void onClick(View v) {
BuildParkingCamera();
Bundle bundle=getIntent().getExtras();
temp=bundle.getInt("Park_ID");
//Toast.makeText(ParkingMain.this,temp+"",Toast.LENGTH_SHORT).show();
BuildMapView();
map=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
LatLng latLngtemp=new LatLng(25.010611, 121.464115);
CameraPosition currentPlace = new CameraPosition.Builder()
.target(latLngtemp)
.bearing(0)
.tilt(65.5f)
.zoom(17)
.build();
//added a tilt[.tilt(65.5f)] value so the map will rotate in 3D.
map.moveCamera(CameraUpdateFactory.newCameraPosition(currentPlace));
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLngtemp,17));
MarkerOptions markerOptions=new MarkerOptions();
markerOptions.position(latLngtemp);
map.addMarker(markerOptions);
Button TWD97_to_WGS84=(Button)findViewById(R.id.latlontest);
TWD97_to_WGS84.setOnClickListener(new TWD97ModeChange());
}
项目:Android-Snippets
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dwarka = new MarkerOptions()
.position(new LatLng(28.5921,77.0460))
.title("Dwarka");
rohini = new MarkerOptions()
.position(new LatLng(28.7495,77.0565))
.title("Rohini");
cp = new MarkerOptions()
.position(new LatLng(28.6315, 77.2167))
.title("Cp");
lajpatnagar = new MarkerOptions()
.position(new LatLng(28.5677,77.2433))
.title("Lajpat Nagar");
MapFragment mapFragment = (MapFragment)getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
项目:The_Elucidated
文件:GMapFragment.java
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
MapFragment fragment = (MapFragment) getChildFragmentManager().findFragmentById(R.id.map);
fragment.getMapAsync(this);
locationManager = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);
if(PermissionCheck.checkPermission(getActivity())){
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this);
mLastLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}
markerController = new MarkerController();
pendingIntentController = new PendingIntentController();
itemController = new ItemController();
questController = new QuestController();
database_functions = Database_Functions.getInstance(getActivity(),getActivity());
user = database_functions.getUserData();
}
项目:nearby-places
文件:SinglePlaceActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.single_place);
//Activity toolbar setup
toolbar = (Toolbar) findViewById(R.id.tool_bar); // Attaching the layout to the toolbar object
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
singleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapSingle)).getMap();
Intent i = getIntent();
// Place referece id
String reference = i.getStringExtra(KEY_REFERENCE);
// Calling a Async Background thread
new LoadSinglePlaceDetails().execute(reference);
}
项目:fme-apps-android
文件:MainActivity.java
/**
* Return false if map is null; true otherwise.
*
*/
private boolean setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the
// map.
if (map == null) {
// Try to obtain the map from the SupportMapFragment.
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (map != null) {
map.getUiSettings().setZoomControlsEnabled(false);
map.setMyLocationEnabled(true);
}
return true;
} else
return false;
}
项目:clean-mercadona
文件:SupermarketsMapFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if(rootView == null) {
rootView = inflater.inflate(R.layout.fragment_map, container, false);
mMapFragment = MapFragment.newInstance();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.map_container, mMapFragment).commit();
getChildFragmentManager().executePendingTransactions();
initMap();
}
return rootView;
}
项目:AndroidCamp
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mActivity = this;
gcm = GoogleCloudMessaging.getInstance(this);
String connectionString = "ListenConnectionString";
hub = new NotificationHub("HubName", connectionString, this);
NotificationsManager.handleNotifications(this, SENDER_ID, MyHandler.class);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMyLocationEnabled(true);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
registerWithGcm();
}
项目:RideOut
文件:PolylineFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mapView = inflater.inflate(R.layout.fragment_playback_overview, container, false);
MapFragment mapFragment =
(MapFragment) getChildFragmentManager().findFragmentById(R.id.map_overview);
if ( mapFragment != null ){
mapFragment.getMapAsync(this);
} else {
Log.e(TAG, "MapFragment not found!");
}
return mapView;
}
项目:RideOut
文件:PlaybackOverviewFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mapView = inflater.inflate(R.layout.fragment_playback_overview, container, false);
MapFragment mapFragment =
(MapFragment) getChildFragmentManager().findFragmentById(R.id.map_overview);
if ( mapFragment != null ){
mapFragment.getMapAsync(this);
} else {
Log.e(TAG, "MapFragment not found!");
}
return mapView;
}
项目:androidClient
文件:RestaurantAdapter.java
public RestaurantViewHolder(Activity activity, RestaurantAdapter parentAdapter) {
this.activity = activity;
this.parentAdapter = parentAdapter;
proximity = (TextView) activity.findViewById(R.id.distance);
dialPhone = (ImageView) activity.findViewById(R.id.phone);
visitWebsite = (ImageView) activity.findViewById(R.id.website);
address = (TextView) activity.findViewById(R.id.address);
map = ((MapFragment) activity.getFragmentManager().findFragmentById(R.id.map))
.getMap();
map.getUiSettings().setScrollGesturesEnabled(false);
dialPhone.setOnClickListener(this);
visitWebsite.setOnClickListener(this);
}
项目:mage-android
文件:ObservationFormPickerActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_observation_form_picker);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.forms);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
layoutManager.setFlexDirection(FlexDirection.ROW);
layoutManager.setJustifyContent(JustifyContent.CENTER);
recyclerView.setLayoutManager(layoutManager);
JsonArray formDefinitions = EventHelper.getInstance(getApplicationContext()).getCurrentEvent().getForms();
Adapter adapter = new Adapter(this, formDefinitions);
recyclerView.setAdapter(adapter);
findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel(v);
}
});
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
项目:NSIT-Connect
文件:PlaceMapActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_place_maps);
// Initialize variables
transition = (TextView) findViewById(R.id.destination);
time = (TextView) findViewById(R.id.time);
distance = (TextView) findViewById(R.id.distance);
progressBar = (ProgressBar) findViewById(R.id.progress_path);
// Get data from previous activity
Intent intent = getIntent();
Lati = Double.parseDouble(intent.getStringExtra(HangoutsTypeDisplay.HangoutTypeAdapter.INTENT_LATI));
Longi = Double.parseDouble(intent.getStringExtra(HangoutsTypeDisplay.HangoutTypeAdapter.INTENT_LONG));
place_name = intent.getStringExtra(HangoutsTypeDisplay.HangoutTypeAdapter.INTENT_PLACE_NAME);
place_id = intent.getStringExtra(HangoutsTypeDisplay.HangoutTypeAdapter.INTENT_PLACE_ID);
mHandler = new Handler(Looper.getMainLooper());
transition.setText("Current Location To " + place_name);
// Initialize map
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.place_map);
mapFragment.getMapAsync(this);
}
项目:message-samples-android
文件:MapViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_view);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
mLatlng = getIntent().getStringExtra("latlng");
if (mapMessageLocation == null) {
mapMessageLocation = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapMessageLocation));
}
mapMessageLocation.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap map) {
loadMap(map, mLatlng);
}
});
}
项目:io2015-codelabs
文件:MapActivity.java
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
// Set the layout. It only contains a SupportMapFragment and a DismissOverlay.
setContentView(R.layout.activity_map);
// Obtain the Attraction that we need to display.
mAttraction = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTION);
// Obtain the DismissOverlayView and display the intro help text.
mDismissOverlay = (DismissOverlayView) findViewById(R.id.map_dismiss_overlay);
mDismissOverlay.setIntroText(R.string.exit_intro_text);
mDismissOverlay.showIntroIfNecessary();
// Obtain the MapFragment and set the async listener to be notified when the map is ready.
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
项目:eme_road
文件:IncidentActivity.java
private void createMapView(){
try {
if(null == googleMap){
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.mapView)).getMap();
googleMap.getUiSettings().setZoomGesturesEnabled(true);
if(null == googleMap) {
Toast.makeText(getApplicationContext(),
"Error creating map", Toast.LENGTH_SHORT).show();
}
}
} catch (NullPointerException exception){
Log.e("mapApp", exception.toString());
}
}
项目:eme_road
文件:SubmitMapActivity.java
private void createMapView(){
try {
if(null == googleMap){
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.mapView)).getMap();
googleMap.getUiSettings().setZoomGesturesEnabled(true);
if(null == googleMap) {
Toast.makeText(getApplicationContext(),
"Error creating map", Toast.LENGTH_SHORT).show();
}
}
} catch (NullPointerException exception){
Log.e("mapApp", exception.toString());
}
}
项目:eme_road
文件:NearbyIncidentsMapActivity.java
private void createMapView(){
try {
if(null == googleMap){
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.mapView)).getMap();
googleMap.getUiSettings().setZoomGesturesEnabled(true);
if(null == googleMap) {
Toast.makeText(getApplicationContext(),
"Error creating map", Toast.LENGTH_SHORT).show();
}
}
} catch (NullPointerException exception){
Log.e("mapApp", exception.toString());
}
}
项目:GoogleMapsV2
文件:MainActivity.java
/**
* function to load map. If map is not created it will create it for you
* */
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(this, "Sorry! unable to create maps",
Toast.LENGTH_SHORT).show();
return;
}
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
// set my location
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setCompassEnabled(false);
googleMap.getUiSettings().setRotateGesturesEnabled(false);
// set zooming controll
googleMap.getUiSettings().setZoomControlsEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
googleMap.setOnMapClickListener(this);
}
}
项目:mdapp
文件:PharmaciesLocationMapActivity.java
private void showMap()
{
if(mPharmacyAddressesSize == 0)
{
mTools.showToast(getString(R.string.pharmacies_location_map_location_not_found), 1);
finish();
}
else
{
mTools.showToast(getString(R.string.pharmacies_location_map_locating), 0);
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.pharmacies_location_map_map);
mapFragment.getMapAsync(this);
}
}
项目:veganfriendly
文件:MapActivity.java
private void setupMap(){
if(map == null){
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (map != null){
map.setInfoWindowAdapter(new InfoWindow(getLayoutInflater(), markersOnMap, this));
map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
openRestaurant(marker);
}
});
}
}
map.setMyLocationEnabled(true);
mapCenter = map.getCameraPosition();
map.setOnCameraChangeListener(new OurCameraChangedListener());
}
项目:school
文件:MapsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapartist);
MapFragment mf = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mf.getMapAsync(this);
geocoder = new Geocoder(this);
Intent myCallerIntentHandler = getIntent();
Bundle myBundle = myCallerIntentHandler.getExtras();
paramArray = myBundle.getIntegerArrayList("myIntArray1");
artistList = (ArrayList<artist>) myBundle.getSerializable("artists");
latlongCheck(paramArray,artistList);
retrieveCities(paramArray,artistList);
}
项目:AntennaMap
文件:MapsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Find view elements
progressSpinner = this.findViewById(R.id.progressSpinner);
progressSpinner.setVisibility(ProgressBar.GONE);
// Initialize map
final MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
// Save this instance to a static variable to make it possible to refresh map
MapsActivity.instance = this;
// Initialize Services in the background
ASR.init(getApplicationContext());
}
项目:MentorMe
文件:ViewProfileActivity.java
private void setupViews() {
ivMentorProfile = (ImageView) findViewById(R.id.ivMentorProfile);
tvFirstName = (TextView) findViewById(R.id.tvFirstName);
tvLastName = (TextView) findViewById(R.id.tvLastName);
tvPosition = (TextView) findViewById(R.id.tvPosition);
tvLocation = (TextView) findViewById(R.id.tvLocation);
tvDistance = (TextView) findViewById(R.id.tvDistance);
tvMenteeCount = (TextView) findViewById(R.id.tvMenteeCount);
rbRating = (RatingBar) findViewById(R.id.rbRating);
rbMyRating = (RatingBar) findViewById(R.id.rbRatingMe);
customizeProgressBar(rbRating, false);
customizeProgressBar(rbMyRating, true);
tvNoOfRating = (TextView) findViewById(R.id.tvNoOfRating);
tvAddReview = (TextView) findViewById(R.id.tvAddReview);
tvAboutMe = (TextView) findViewById(R.id.tvAboutMe);
llMentorSkills = (LinearLayout) findViewById(R.id.llMentorSkills);
llMenteeSkills = (LinearLayout) findViewById(R.id.llMenteeSkills);
tvYearsExperience = (TextView) findViewById(R.id.tvYearsExperience);
tvMentorSkills = (TextView) findViewById(R.id.tvMentorSkills);
tvMenteeSkills = (TextView) findViewById(R.id.tvMenteeSkills);
tvAvailabilityHeader = (TextView) findViewById(R.id.tvAvailabilityHeader);
llAvailability = (LinearLayout) findViewById(R.id.llAvailability);
ivMentee = (ImageView) findViewById(R.id.ivMentee);
fragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
}
项目:redningsselskapet
文件:MainActivity.java
@Override
protected void onResume() {
super.onResume();
if (mMap == null) {
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// my position might not be necessary
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setCompassEnabled(true);
}
KMLParser.updateData(mMap, this);
mLocation.startPositionFetching();
updatePositionFields();
}
项目:Geolocalizaci-nAndroid
文件:MainActivity.java
private void setUpMapIfNeeded() {
// Configuramos el objeto GoogleMaps con valores iniciales.
if (mMap == null) {
//Instanciamos el objeto mMap a partir del MapFragment definido bajo el Id "map"
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// Chequeamos si se ha obtenido correctamente una referencia al objeto GoogleMap
if (mMap != null) {
// El objeto GoogleMap ha sido referenciado correctamente
//ahora podemos manipular sus propiedades
//Seteamos el tipo de mapa
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//Activamos la capa o layer MyLocation
mMap.setMyLocationEnabled(true);
}
}
}
项目:Geolocalizaci-nAndroid
文件:Mapa.java
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ECUADOR, 12));
mMap.addMarker(new MarkerOptions().position(
new LatLng(43.533, 85.948)).title(
"Hola"));
/*mLocRequest = LocationRequest.create();
mLocRequest.setInterval(30000);
mLocRequest.setSmallestDisplacement(5);
mLocRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
mLocClient = new LocationClient(this,this,this);
if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS){
mLocClient.connect();
}*/
}
项目:CoHomeAndroid
文件:ViewAd.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_ad);
JSONObject j;
Intent intent = getIntent();
String response = intent.getStringExtra(SearchAd.EXTRA_MESSAGE);
//System.out.println(message);
try {
j = new JSONObject(response);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(Double.parseDouble(j.getJSONObject("coordinate").getString("lat")),Double.parseDouble(j.getJSONObject("coordinate").getString("lng")))) // Sets the center of the map to Mountain View
.zoom(13) // Sets the zoom
.build(); // Creates a CameraPosition from the builder
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
JSONArray a = j.getJSONArray("annunci");
for(int index=0; index<a.length()-1;index++)
addMarker((JSONObject)a.get(index));
} catch (JSONException e) {
e.printStackTrace();
}
}
项目:PalHunterClient
文件:MapActivity.java
private void init() {
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
mMap.getUiSettings().setMyLocationButtonEnabled(true);
mMap.setMyLocationEnabled(true);
LatLng position = new LatLng(lat, lng);
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(lat, lng));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(16);
mMap.moveCamera(center);
mMap.animateCamera(zoom);
Marker marker = mMap.addMarker(new MarkerOptions().position(position)
.title(nick).snippet(nick)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));
marker.showInfoWindow();
}
项目:phimpme-android-v1
文件:GeographicalLocationActivity.java
private void googleMapInit() {
setContentView(R.layout.activity_googlemapgpsmanager);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.GPSManagerActivityMap)).getMap();
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.GPSManagerActivityMap))
.getMap();
} else if (mMap != null) {
imageUri = (Uri) getIntent().getExtras().get("imageUri");
try {
String degreeGPS = new ConvertLatlng().convertToDegreeForm(imageUri.getPath());
String[] position = degreeGPS.split(";");
CameraPosition cameraPosition = new CameraPosition.Builder().
target(new LatLng(Double.parseDouble(position[0]), Double.parseDouble(position[1])))
.zoom(13)
.build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
} catch (IOException e) {
e.printStackTrace();
}
}
}
项目:morpho
文件:MainActivity.java
private void setUpMapIfNeeded() {
if (map == null) {
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (map != null) {
map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(19.054359, -98.283107), 18));
map.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
@Override
public void onMapLongClick(LatLng point) {
if (locationClient.isConnected() && isUsingMockLocations) {
Location newLocation = new Location(MOCK_LOCATION_PROVIDER);
newLocation.setLatitude(point.latitude);
newLocation.setLongitude(point.longitude);
newLocation.setTime(System.nanoTime());
newLocation.setAccuracy(0f);
newLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
locationClient.setMockLocation(newLocation);
}
}
});
}
}
}
项目:paktebe
文件:PetaLokasi.java
@SuppressLint("NewApi")
private void setupMapIfNeeded() {
// TODO Auto-generated method stub
if (map == null) {
map = ((MapFragment) getFragmentManager().findFragmentById(
R.id.petaLokasi)).getMap();
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(-7.714564, 110.335386)).zoom(13).build();
map.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
if (map != null) {
setupMap();
}
}
}
项目:Geo-Fi
文件:MainActivity.java
/**
* @TODO Add description.
*
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Obtain a reference to Google Map
mGoogleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// Enable My Location Layer
mGoogleMap.setMyLocationEnabled(true);
// Create a new global location parameters object
mLocationRequest = LocationRequest.create();
// Set the update interval
mLocationRequest.setInterval(LocationUtils.UPDATE_INTERVAL_IN_MILLISECONDS);
// Use high accuracy
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// Set the interval ceiling to one minute
mLocationRequest.setFastestInterval(LocationUtils.FAST_INTERVAL_CEILING_IN_MILLISECONDS);
// Note that location updates are off until the user turns them on
mUpdatesRequested = true;
// Create a new location client, using the enclosing class to handle callbacks.
mLocationClient = new LocationClient(this, this, this);
wifiManager = (WifiManager) getBaseContext()
.getSystemService(Context.WIFI_SERVICE);
}
项目:ftw-android
文件:MapActivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Intent intent = getIntent();
if (intent.hasExtra(ARG_ROUTE)) {
setTitle(intent.getStringExtra(ARG_ROUTE));
}
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.addMarker(new MarkerOptions().position(new LatLng(43.661484, -79.382248)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.675751, -79.319649)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.671268, -79.326553)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.655251, -79.418831)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.663567, -79.36763)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.658699, -79.3963009)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.687817, -79.301613)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.661366, -79.38343)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.648468, -79.457863)));
mMap.addMarker(new MarkerOptions().position(new LatLng(43.656601, -79.407303)));
// LatLngBounds bounds = new LatLngBounds(new LatLng(43.648468, -79.457863), new LatLng(43.687817, -79.301613));
// mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
}
项目:shareyourride
文件:MainActivity.java
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
v2GetRouteDirection = new GMapV2GetRouteDirection();
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setZoomControlsEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
// googleMap.getUiSettings().setAllGesturesEnabled(true);
// googleMap.setTrafficEnabled(true);
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(googleMap.getMyLocation().getLatitude(),
googleMap.getMyLocation().getLongitude()), 14));
// googleMap.animateCamera(CameraUpdateFactory.zoomTo(8));
markerOptions = new MarkerOptions();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
项目:stolpersteine-android
文件:MapActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Configure map
if (map == null) {
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.fragmentMap)).getMap();
if (map != null) {
setUpMap();
setUpLocationService();
}
}
// Start synchronizing data
StolpersteineNetworkService networkService = new StolpersteineNetworkService(this, BuildConfig.APP_API_USER, BuildConfig.APP_API_PASSWORD);
networkService.getDefaultSearchData().setCity(BuildConfig.APP_FILTER);
synchronizationController = new SynchronizationController(networkService);
synchronizationController.setListener(this);
synchronizationController.synchronize();
}