當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。