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


Java GoogleMap.clear方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.GoogleMap.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java GoogleMap.clear方法的具體用法?Java GoogleMap.clear怎麽用?Java GoogleMap.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.clear方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMapReady

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    googleMap.clear();
    GoToMap = googleMap;
    Intent i = getIntent();
    ArrayList<LatLng> list1 = i.getParcelableArrayListExtra("key1");
    ArrayList<String> list2 = i.getStringArrayListExtra("key2");
    ArrayList<String> list3 = i.getStringArrayListExtra("key3");

    LatLng latLng = new LatLng(0, 0);
    int j = list1.size();
    j=j-1;
    while (j!=-1)
    {
        if(list1.get(j)!=latLng)
        {   Log.i(list1.get(j).toString(),list1.get(j).toString());
            GoToMap.addMarker(new MarkerOptions().position(list1.get(j)).draggable(true).title(list3.get(j).replace(',','.')+" Battery Power "+list2.get(j)));
            GoToMap.moveCamera(CameraUpdateFactory.newLatLng(list1.get(j)));
        }
        j--;
    }
    // Add a marker in Sydney and move the camera
}
 
開發者ID:ayushghd,項目名稱:iSPY,代碼行數:33,代碼來源:MapsActivity.java

示例2: setMarkers

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
private void setMarkers(GoogleMap map, List<Restaurant> restaurants) {
    if (map == null) {
        return;
    }
    map.clear();
    MarkerOptions options = new MarkerOptions().position(
            new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble()))
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.current_location));
    map.addMarker(options);
    for (Restaurant restaurant : restaurants) {
        MarkerOptions markerOptions = new MarkerOptions().position(
                new LatLng(restaurant.mLatitude, restaurant.mLongitude))
                .title(restaurant.mName)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_pin));
        Marker marker = map.addMarker(markerOptions);
        marker.setTag(restaurant);
    }
    mMap.setOnInfoWindowClickListener(mInfoWindowClickListener);
}
 
開發者ID:boldijar,項目名稱:today-menu-android,代碼行數:20,代碼來源:RestaurantsMapFragment.java

示例3: refreshMap

import com.google.android.gms.maps.GoogleMap; //導入方法依賴的package包/類
private void refreshMap(GoogleMap mapInstance){
    mapInstance.clear();
}
 
開發者ID:ayushghd,項目名稱:iSPY,代碼行數:4,代碼來源:ShortestDistance.java


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