當前位置: 首頁>>代碼示例>>Java>>正文


Java SupportMapFragment.getMapAsync方法代碼示例

本文整理匯總了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);
}
 
開發者ID:OlgaKuklina,項目名稱:GitJourney,代碼行數:25,代碼來源:GeneralActivity.java

示例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();
}
 
開發者ID:Francescopaolo44,項目名稱:MedicalMe,代碼行數:24,代碼來源:MapsActivity.java

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

}
 
開發者ID:agarwal-akash,項目名稱:BonAppetit_Android-Project,代碼行數:21,代碼來源:MapsActivity.java

示例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();
}
 
開發者ID:adithya321,項目名稱:Instincts-2k17,代碼行數:26,代碼來源:MapsActivity.java

示例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);
}
 
開發者ID:abicelis,項目名稱:Remindy,代碼行數:12,代碼來源:PlaceActivity.java

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

}
 
開發者ID:carlosfaria94,項目名稱:UbiBike-client,代碼行數:31,代碼來源:DisplayRoute.java

示例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);
}
 
開發者ID:micromasterandroid,項目名稱:androidadvanced,代碼行數:8,代碼來源:PhotoMapFragment.java

示例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();
}
 
開發者ID:ProjectIndoor,項目名稱:projectindoorapp,代碼行數:40,代碼來源:MapActivity.java

示例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);
}
 
開發者ID:team-htbr,項目名稱:1617PROJ1Bloeddonatie-app,代碼行數:10,代碼來源:MapsActivity.java

示例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);
}
 
開發者ID:alaskalinuxuser,項目名稱:apps_small,代碼行數:10,代碼來源:MapsActivity.java

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


}
 
開發者ID:aliumujib,項目名稱:Nibo,代碼行數:30,代碼來源:BaseNiboFragment.java

示例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);
}
 
開發者ID:Aifryz,項目名稱:FireHelper,代碼行數:11,代碼來源:MapsActivityCurrentPlace.java

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

}
 
開發者ID:thandomy,項目名稱:foodie,代碼行數:29,代碼來源:HomeActivity.java

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


}
 
開發者ID:ahmadnurhidayat,項目名稱:Taxi-App-Android-XML,代碼行數:13,代碼來源:MyTrip.java

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



}
 
開發者ID:StudySpaces327,項目名稱:Study_BU,代碼行數:32,代碼來源:MapActivity.java


注:本文中的com.google.android.gms.maps.SupportMapFragment.getMapAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。