当前位置: 首页>>代码示例>>Java>>正文


Java MapFragment类代码示例

本文整理汇总了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);

}
 
开发者ID:rahul051296,项目名称:quake-alert-android-app,代码行数:22,代码来源:MapsActivity.java

示例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();
}
 
开发者ID:bellol,项目名称:NSW-Petrol-Prices,代码行数:19,代码来源:DashboardActivity.java

示例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));
		}
	});
}
 
开发者ID:CMPUT301W15T09,项目名称:Team9Project,代码行数:25,代码来源:GeolocationActivity.java

示例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;
}
 
开发者ID:ur13l,项目名称:Guanajoven,代码行数:23,代码来源:DetalleRegionFragment.java

示例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);
}
 
开发者ID:mobility-profile,项目名称:Mobility-Profile,代码行数:17,代码来源:YourPlaceActivity.java

示例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());
}
 
开发者ID:Chao-wei-chu,项目名称:TWD97_change_to_WGS,代码行数:27,代码来源:ParkingMain.java

示例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);
}
 
开发者ID:NikhilBhutani,项目名称:Android-Snippets,代码行数:26,代码来源:MainActivity.java

示例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();
}
 
开发者ID:TransCoders,项目名称:The_Elucidated,代码行数:21,代码来源:GMapFragment.java

示例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);
}
 
开发者ID:zubiix,项目名称:nearby-places,代码行数:22,代码来源:SinglePlaceActivity.java

示例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;
}
 
开发者ID:safesoftware,项目名称:fme-apps-android,代码行数:21,代码来源:MainActivity.java

示例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;
}
 
开发者ID:martarodriguezm,项目名称:clean-mercadona,代码行数:17,代码来源:SupermarketsMapFragment.java

示例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();
}
 
开发者ID:Azure-Readiness,项目名称:AndroidCamp,代码行数:23,代码来源:MainActivity.java

示例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;
}
 
开发者ID:ehigham,项目名称:RideOut,代码行数:18,代码来源:PolylineFragment.java

示例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;
}
 
开发者ID:ehigham,项目名称:RideOut,代码行数:17,代码来源:PlaybackOverviewFragment.java

示例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);

}
 
开发者ID:TheBurrd,项目名称:androidClient,代码行数:17,代码来源:RestaurantAdapter.java


注:本文中的com.google.android.gms.maps.MapFragment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。