本文整理汇总了Java中com.google.android.gms.maps.SupportMapFragment.getMapAsync方法的典型用法代码示例。如果您正苦于以下问题:Java SupportMapFragment.getMapAsync方法的具体用法?Java SupportMapFragment.getMapAsync怎么用?Java SupportMapFragment.getMapAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.SupportMapFragment
的用法示例。
在下文中一共展示了SupportMapFragment.getMapAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItem
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
public Fragment getItem(int position) {
Log.v(TAG, "getItem, position = " + position);
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
switch (position) {
case 0:
return FeedListFragment.newInstance();
case 1:
return RepositoriesListFragment.newInstance();
case 2:
return FollowingListFragment.newInstance();
case 3:
return FollowersListFragment.newInstance();
case 4:
return StarsListFragment.newInstance();
case 5:
LocationsReadyCallback callback = new LocationsReadyCallback(GeneralActivity.this);
SupportMapFragment fragment = SupportMapFragment.newInstance();
fragment.getMapAsync(callback);
return fragment;
}
return PlaceholderFragment.newInstance(position + 1);
}
示例2: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Retrieve location and camera position from saved instance state.
if (savedInstanceState != null) {
mCurrentLocation = savedInstanceState.getParcelable(KEY_LOCATION);
mCameraPosition = savedInstanceState.getParcelable(KEY_CAMERA_POSITION);
}
setContentView(R.layout.activity_maps);
//---------------------add maps fragments-----------------------
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(map);
mapFragment.getMapAsync(this);
//build Google place API
buildGoogleApiClient();
mGoogleApiClient.connect();
}
示例3: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
//preparing GoogleApiClient
mGoogleApiClient=new GoogleApiClient.Builder(this)
.addApi(Places.GEO_DATA_API)
.build();
mGoogleApiClient.connect();
//Yes! finally Firebase :P
Firebase.setAndroidContext(this);
mFirebase=new Firebase(FIREBASE_URL);
mFirebase.child(FIREBASE_ROOT_NODE).addChildEventListener(this);
}
示例4: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
location = getIntent().getStringExtra("location");
stringToLatLngMap = new HashMap<>();
stringToLatLngMap.put("Main Auditorium", MAIN_AUDITORIUM);
stringToLatLngMap.put("Main Stage", MAIN_STAGE);
stringToLatLngMap.put("Mini Auditorium", MINI_AUDITORIUM);
stringToLatLngMap.put("ECE Seminar Hall", ECE_SEMINAR_HALL);
stringToLatLngMap.put("Central Seminar Hall", CENTRAL_SEMINAR_HALL);
stringToLatLngMap.put("CSE Seminar Hall", CSE_SEMINAR_HALL);
stringToLatLngMap.put("IT Seminar Hall", IT_SEMINAR_HALL);
stringToLatLngMap.put("IT Classrooms", IT_CLASSROOMS);
stringToLatLngMap.put("CSE Classrooms", CSE_CLASSROOMS);
stringToLatLngMap.put("IT Labs", IT_LABS);
stringToLatLngMap.put("Fountain", FOUNTAIN);
stringToLatLngMap.put("Mech Seminar Hall", MECH_SEMINAR_HALL);
stringToLatLngMap.put("Food Stalls", FOOD_STALL);
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
attemptEnableMyLocation();
}
示例5: onConnected
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
/**
* Builds the map when the Google Play services client is successfully connected.
*/
@Override
public void onConnected(Bundle connectionHint) {
// Get the SupportMapFragment and request notification
// when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.activity_place_map);
mapFragment.getMapAsync(this);
}
示例6: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_route);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
Intent i = getIntent();
checkingStation = i.getExtras().getBoolean("checkingStation");
//Trajectory to print
List<LatLng> wrap = (List<LatLng>) i.getSerializableExtra("Trajectory");
if(wrap != null)
{
try {
addToJSONArray(track,wrap);
} catch (Exception e) {
e.printStackTrace();
}
}
else if(!checkingStation)
{
Snackbar.make(findViewById(android.R.id.content), "Unable to retrieve path information.", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
stationPos = new LatLng(i.getExtras().getFloat("latitude"),i.getExtras().getFloat("longitude"));
}
示例7: onActivityCreated
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
FragmentManager fm = getChildFragmentManager();
SupportMapFragment mapFragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例8: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
// Initialize wifi manager and wifi receiver for onCreate.
wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
receiver = new WifiReceiver(wifiManager, this);
this.requestPermissions();
}
示例9: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例10: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例11: initmap
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
protected void initmap() {
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
mLocationRepository = new LocationRepository(getActivity(), mGoogleApiClient);
mLocationRepository.getLocationObservable()
.subscribe(new Consumer<Location>() {
@Override
public void accept(@NonNull Location location) throws Exception {
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(location.getLatitude(), location.getLongitude()))
.zoom(15)
.build();
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
handleLocationRetrieval(location);
extractGeocode(location.getLatitude(), location.getLongitude());
}
}, new Consumer<Throwable>() {
@Override
public void accept(@NonNull Throwable throwable) throws Exception {
throwable.printStackTrace();
}
});
}
示例12: onConnected
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
/**
* Builds the map when the Google Play services client is successfully connected.
*/
@Override
public void onConnected(Bundle connectionHint) {
// Build the map.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例13: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_foodie_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
checkLocationPermission();
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapView = mapFragment.getView();
mapView.setContentDescription("MAP NOT READY");
mapFragment.getMapAsync(this);
recieveData();
}
示例14: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_trip);
setTitle(R.id.inc_toolbar,R.id.tv_title, "MY TRIP", R.drawable.ic_back_white, R.color.purple, R.color.white);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
示例15: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
locationTries =0;
Bundle extras = getIntent().getExtras();
if (extras != null) {
cafe = extras.getBoolean("Cafe");
libraries = extras.getBoolean("libraries");
BUspaces = extras.getBoolean("BUonly");
all = extras.getBoolean("All");
if (all) {
cafe = true;
libraries = true;
BUspaces = true;
}
}
setContentView(R.layout.map_activity);
getLocationPermission();
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
// getSupportActionBar().setDisplayShowHomeEnabled(true);
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}