本文整理汇总了Java中com.google.android.gms.maps.SupportMapFragment类的典型用法代码示例。如果您正苦于以下问题:Java SupportMapFragment类的具体用法?Java SupportMapFragment怎么用?Java SupportMapFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SupportMapFragment类属于com.google.android.gms.maps包,在下文中一共展示了SupportMapFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Intent i = getIntent();
latitude = i.getDoubleExtra(LAT_KEY,-8.047);
longitude = i.getDoubleExtra(LON_KEY,-34.876);
SupportMapFragment mapa = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapa);
mapa.getMapAsync(this);
}
示例2: 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);
}
示例3: onCreateView
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail_reminder_location_based, container, false);
mContainer = (LinearLayout) rootView.findViewById(R.id.fragment_reminder_location_based_container);
mAddress = (TextView) rootView.findViewById(R.id.fragment_reminder_location_based_address);
mAddress.setText(mReminder.getPlace().getAddress());
mRadius = (TextView) rootView.findViewById(R.id.fragment_reminder_location_based_radius);
mRadius.setText(String.format(Locale.getDefault(),
getResources().getString(R.string.fragment_detail_location_based_reminder_radius),
mReminder.getPlace().getRadius(),
mReminder.getEnteringExitingString(getActivity())) );
// Get the SupportMapFragment and request notification
// when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.fragment_reminder_location_based_map);
mapFragment.getMapAsync(this);
return rootView;
}
示例4: 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(MapsActivity.this);
mPolyOpt.color(Color.LTGRAY);
distance_value = (TextView) findViewById(R.id.distance_value);
point_value = (TextView) findViewById(R.id.point_value);
time_value = (TextView) findViewById(R.id.time_value);
}
示例5: onCreateView
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View mRootView = inflater.inflate(R.layout.fragment_map,container,false);
hotels = new ArrayList<>();
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map_item);
mapFragment.getMapAsync(this);
recyclerView = (RecyclerView) mRootView.findViewById(R.id.map_recycler_view);
recyclerView.setHasFixedSize(true);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayout.HORIZONTAL);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
mAdapter = new CardViewAdapter(hotels);
mAdapter.setActionListner(this);
recyclerView.setAdapter(mAdapter);
if (mPresenter != null)
mPresenter.loadHotels();
return mRootView;
}
示例6: newMapFragment
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
private static SupportMapFragment newMapFragment() {
return SupportMapFragment.newInstance(new GoogleMapOptions()
.camera(new CameraPosition.Builder()
.target(LocationAdapter.ZERO)
.zoom(DEFAULT_ZOOM)
.build()));
}
示例7: testGetMapFragment
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Test
public void testGetMapFragment() throws MapNotLoadedException {
assertThat(mMap.isMapFragmentSet(), is(false));
SupportMapFragment mapFragment = mMap.getMapFragment();
assertThat(mapFragment, is(not(nullValue())));
assertThat(mMap.isMapFragmentSet(), is(true));
verify(mMap, atLeastOnce()).setMapFragment(mapFragment);
when(mMap.isMapReady()).thenReturn(false);
SupportMapFragment mapFragment2 = mMap.getMapFragment();
assertThat(mapFragment2, is(not(sameInstance(mapFragment))));
when(mMap.isMapReady()).thenReturn(true);
assertThat(mMap.getMapFragment(), is(sameInstance(mapFragment2)));
CivifyMarkers markers = mMap.getMarkers();
mMap.outdateToBeRefreshed();
assertThat(mMap.getMapFragment(), is(not(sameInstance(mapFragment2))));
assertThat(mMap.getMarkers(), is(sameInstance(markers)));
verify(mMap, never()).refreshIssues();
}
示例8: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps_profile);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new NavDrawerSetup(this, toolbar).setupNav();
SupportMapFragment mapFragment =
(SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.profile_map);
mapFragment.getMapAsync(this);
Intent intent = getIntent();
// Get the list of the filtered moods from ProfileActivity
profileFilteredMoods = (ArrayList<Mood>) intent.getSerializableExtra("profileFilteredList");
}
示例9: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
/**
* Flag indicating whether a requested permission has been denied after returning in
* {@link #onRequestPermissionsResult(int, String[], int[])}.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new NavDrawerSetup(this, toolbar).setupNav();
SupportMapFragment mapFragment =
(SupportMapFragment) getSupportFragmentManager().findFragmentById(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);
try {
gpsTracker = new com.trackin.iodroid.trackin.GPSTracker(getApplicationContext());
mLocation = gpsTracker.getLocation();
latitude = mLocation.getLatitude();
longitude = mLocation.getLongitude();
/* Geocoder geocoder = new Geocoder(this);
geocoder.get*/
// 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);
System.out.println("60");
lat = gpsTracker.getLocation().getLatitude();
lng = gpsTracker.getLocation().getLongitude();
} catch (Exception e) {
Toast.makeText(GPSActivity.this,"GPS not enabled!",Toast.LENGTH_LONG);
}
}
示例11: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
ActivityCompat.requestPermissions(MapsActivity.this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, 123);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
GpsTracker gt = new GpsTracker(getApplicationContext());
Location l = gt.getLocation();
if( l == null){
Toast.makeText(getApplicationContext(),"GPS unable to get Value",Toast.LENGTH_SHORT).show();
}else {
double lat = l.getLatitude();
double lon = l.getLongitude();
Toast.makeText(getApplicationContext(),"GPS Lat = "+lat+"\n lon = "+lon,Toast.LENGTH_SHORT).show();
}
}
示例12: initView
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
private void initView() {
locationPin = findViewById(R.id.location_pin);
currentLocationBtn = findViewById(R.id.my_location_btn);
checkPointsListBtn = findViewById(R.id.check_points_list_btn);
View bottomSheet = findViewById(R.id.bottom_sheet);
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setHideable(true);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
RecyclerView checkPointsList = findViewById(R.id.check_point_list_view);
checkPointsList.setLayoutManager(new LinearLayoutManager(context));
checkPointsList.setAdapter(checkPointsAdapter);
autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.search_places_fragment);
SupportMapFragment supportMapFragment =
(SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
supportMapFragment.getMapAsync(this);
bindEvents();
}
示例13: 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();
}
示例14: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.maps_lokasi);
mapFragment.getMapAsync(this);
latitude = "-6.235510";
longitude = "106.747263";
toolbar = (Toolbar) findViewById(R.id.tool_bar); // Attaching the layout to the toolbar object
toolbar.setLogoDescription(getResources().getString(R.string.sign_up_title));
toolbar.setTitleTextColor(getResources().getColor(R.color.title));
toolbar.setTitle("Rawan");
}
示例15: onCreate
import com.google.android.gms.maps.SupportMapFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FontAwesome.apply();
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);
permissions = new Permissions(this);
dialogView = new DialogView(this);
locationButton = (Button) findViewById(R.id.location);
locationButton.setOnClickListener(this);
save = (TextView) findViewById(R.id.save);
save.setOnClickListener(this);
}