本文整理汇总了Java中com.google.android.gms.maps.MapFragment.getMapAsync方法的典型用法代码示例。如果您正苦于以下问题:Java MapFragment.getMapAsync方法的具体用法?Java MapFragment.getMapAsync怎么用?Java MapFragment.getMapAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.MapFragment
的用法示例。
在下文中一共展示了MapFragment.getMapAsync方法的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: 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);
}
示例3: 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);
}
示例4: 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();
}
示例5: 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;
}
示例6: 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;
}
示例7: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@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);
}
示例8: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@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);
}
示例9: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
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);
}
示例10: showMap
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
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);
}
}
示例11: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@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);
}
示例12: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@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());
}
示例13: fillMap
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
private void fillMap(){
final MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
map.setMyLocationEnabled(false);
map.getUiSettings().setTiltGesturesEnabled(false);
map.getUiSettings().setMyLocationButtonEnabled(false);
map.getUiSettings().setMapToolbarEnabled(false);
map.clear();
boolean first = true;
PolylineOptions line = new PolylineOptions();
map.addPolyline(line);
for (ChronicleEvent event : bartour.getChronicle().getChronicleEvents(LocationChronicleEvent.class)) {
LocationChronicleEvent locationEvent = (LocationChronicleEvent) event;
if (first) {
first = false;
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(locationEvent.getLatitude(), locationEvent.getLongitude()), 15));
}
MarkerOptions marker = new MarkerOptions();
LatLng latLng = new LatLng(locationEvent.getLatitude(), locationEvent.getLongitude());
marker.title(locationEvent.getLocationName().toString())
.position(latLng);
if (locationEvent instanceof ATMLocationChronicleEvent) {
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_money_pin));
} else {
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_beer_pin));
}
map.addMarker(marker);
line.add(latLng);
}
map.addPolyline(line);
}
});
}
示例14: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
MapFragment mapFragment= (MapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例15: onCreate
import com.google.android.gms.maps.MapFragment; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}