本文整理汇总了Java中com.google.android.gms.maps.MapFragment类的典型用法代码示例。如果您正苦于以下问题:Java MapFragment类的具体用法?Java MapFragment怎么用?Java MapFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapFragment类属于com.google.android.gms.maps包,在下文中一共展示了MapFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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);
}
示例2: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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();
}
示例3: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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));
}
});
}
示例4: onCreateView
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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;
}
示例5: initializeViewElements
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
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);
}
示例6: onClick
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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());
}
示例7: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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);
}
示例8: onViewCreated
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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();
}
示例9: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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);
}
示例10: setUpMapIfNeeded
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
/**
* 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;
}
示例11: onCreateView
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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;
}
示例12: onCreate
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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();
}
示例13: onCreateView
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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;
}
示例14: onCreateView
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
@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;
}
示例15: RestaurantViewHolder
import com.google.android.gms.maps.MapFragment; //导入依赖的package包/类
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);
}