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


Java MapView類代碼示例

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


MapView類屬於com.google.android.gms.maps包,在下文中一共展示了MapView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
 * Called on activity start. Generates layout and button functionality.
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my_habits_map);

    events = (ArrayList<HabitEvent>) getIntent().getSerializableExtra("event list");
    if (events==null || events.size()<1){finish();}


    Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
    toolbar.setTitle("Map of My Habit History");
    toolbar.setNavigationIcon(R.drawable.ic_close_button);
    setSupportActionBar(toolbar);

    map = (MapView) findViewById(R.id.myHabitsMap);
    map.onCreate(savedInstanceState);
    map.getMapAsync(this);
}
 
開發者ID:CMPUT301F17T09,項目名稱:GoalsAndHabits,代碼行數:23,代碼來源:MyHabitsMapActivity.java

示例2: preLoadGoogleMaps

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void preLoadGoogleMaps() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                MapView mv = new MapView(getApplicationContext());
                mv.onCreate(null);
                mv.onPause();
                mv.onDestroy();
            } catch (Exception ignored) {
                // ignored
            }
        }
    }).start();
}
 
開發者ID:GrenderG,項目名稱:Protestr,代碼行數:17,代碼來源:MainActivity.java

示例3: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view =  inflater.inflate(R.layout.fragment_challenge_sender, container, false);

    mapView = (MapView) view.findViewById(R.id.mapView);
    mapView.onCreate(savedInstanceState);
    mapView.getMapAsync(this);

    googleApiClient = ((ChallengeActivity)getActivity()).getGoogleApiClient();
    locationSettingsHandler = ((ChallengeActivity)getActivity()).getLocationSettingsHandler();

    distance = (TextView) view.findViewById(R.id.sender_distance);

    String userName = ((AppRunnest)getActivity().getApplication()).getUser().getName();
    run = new Run(userName);

    return view;
}
 
開發者ID:IrrilevantHappyLlamas,項目名稱:Runnest,代碼行數:19,代碼來源:ChallengeSenderFragment.java

示例4: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view =  inflater.inflate(R.layout.fragment_running_map, container, false);

    // Buttons
    GUISetup(view);

    mapView = (MapView) view.findViewById(R.id.mapView);
    mapView.onCreate(savedInstanceState);
    mapView.getMapAsync(this); //this is important

    // Location
    setupLocation();

    return view;
}
 
開發者ID:IrrilevantHappyLlamas,項目名稱:Runnest,代碼行數:19,代碼來源:RunningMapFragment.java

示例5: createViewInstance

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
 * Implementation of the react create view instance method - returns the map view to react.
 *
 * @param context
 * @return MapView
 */
@Override
protected MapView createViewInstance(ThemedReactContext context) {
    mapView = new MapView(context);

    mapView.onCreate(null);
    mapView.onResume();

    if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
    }

    reactContext = context;

    return mapView;
}
 
開發者ID:Pod-Point,項目名稱:react-native-maps,代碼行數:22,代碼來源:PPTGoogleMapManager.java

示例6: getScreenshotBitmap

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@NonNull
@Override
public Observable<Bitmap> getScreenshotBitmap(@NonNull final Activity activity) {
    final Observable<Bitmap> nonMapViewsBitmapObservable = getNonMapViewsBitmap(activity);

    final View rootView = ActivityUtils.getRootView(activity);
    final List<MapView> mapViews = locateMapViewsInHierarchy(rootView);

    if (mapViews.isEmpty()) {
        return nonMapViewsBitmapObservable;
    } else {
        final Observable<List<LocatedBitmap>> mapViewBitmapsObservable
                = getMapViewBitmapsObservable(mapViews);

        return Observable
                .zip(nonMapViewsBitmapObservable, mapViewBitmapsObservable, BITMAP_COMBINING_FUNCTION);
    }
}
 
開發者ID:stkent,項目名稱:bugshaker-android,代碼行數:19,代碼來源:MapScreenshotProvider.java

示例7: locateMapViewsInHierarchy

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@NonNull
@VisibleForTesting
protected List<MapView> locateMapViewsInHierarchy(@NonNull final View view) {
    final List<MapView> result = new ArrayList<>();

    final Queue<View> viewsToProcess = new LinkedList<>();
    viewsToProcess.add(view);

    while (!viewsToProcess.isEmpty()) {
        final View viewToProcess = viewsToProcess.remove();

        if (viewToProcess instanceof MapView && viewToProcess.getVisibility() == VISIBLE) {
            result.add((MapView) viewToProcess);
        } else if (viewToProcess instanceof ViewGroup) {
            final ViewGroup viewGroup = (ViewGroup) viewToProcess;

            for (int childIndex = 0; childIndex < viewGroup.getChildCount(); childIndex++) {
                viewsToProcess.add(viewGroup.getChildAt(childIndex));
            }
        }
    }

    return result;
}
 
開發者ID:stkent,項目名稱:bugshaker-android,代碼行數:25,代碼來源:MapScreenshotProvider.java

示例8: onViewCreated

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mapView = (MapView) view.findViewById(R.id.ec_mapview);
    if(mapView != null) {
        mapView.onCreate(savedInstanceState);
    }

    if (defaultSceneLocations != null) {
        List<String> list = new ArrayList<String>();
        for (LocationItem scLoc : defaultSceneLocations) {
            list.add(scLoc.getTitle());
        }
        setupPins();
    }

    mapButton = (Button) view.findViewById(R.id.map_button);
    satelliteButton = (Button) view.findViewById(R.id.satellite_button);
    if (satelliteButton != null && mapButton != null) {
        mapButton.setOnClickListener(this);
        satelliteButton.setOnClickListener(this);
        onClick(mapButton);
    }

}
 
開發者ID:warnerbros,項目名稱:cpe-manifest-android-experience,代碼行數:26,代碼來源:ECSceneLocationMapFragment.java

示例9: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(
    LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View rootView = inflater.inflate(R.layout.map_fragment, container, false);
  mMapView = ((MapView) rootView.findViewById(R.id.map));
  mMapView.onCreate(savedInstanceState);
  mMapView.getMapAsync(this);
  MapsInitializer.initialize(getActivity());

  RealTimePositionVelocityCalculator currentPositionVelocityCalculator =
      mPositionVelocityCalculator;
  if (currentPositionVelocityCalculator != null) {
    currentPositionVelocityCalculator.setMapFragment(this);
  }

  return rootView;
}
 
開發者ID:google,項目名稱:gps-measurement-tools,代碼行數:18,代碼來源:MapFragment.java

示例10: onSaveInstanceState

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    movementManager.onSaveInstanceState(savedInstanceState);
    pinningManager.onSaveInstanceState(savedInstanceState);
    savedInstanceState.putBoolean(BUNDLE_OSM_ACTIVE, osmActive);
    if (!osmActive) {
        Bundle mapBundle = new Bundle();
        googleMapView.onSaveInstanceState(mapBundle);

        savedInstanceState.putBundle(BUNDLE_MAP, mapBundle);
    }else if (jotiMap instanceof OsmJotiMap){
        org.osmdroid.views.MapView osmMap = ((OsmJotiMap) jotiMap).getOSMMap();
        Bundle osmMapBundle = new Bundle();
        osmMapBundle.putInt(OSM_ZOOM, osmMap.getZoomLevel());
        osmMapBundle.putDouble(OSM_LAT, osmMap.getMapCenter().getLatitude());
        osmMapBundle.putDouble(OSM_LNG, osmMap.getMapCenter().getLongitude());
        osmMapBundle.putFloat(OSM_OR, osmMap.getMapOrientation());
        savedInstanceState.putBundle(OSM_BUNDLE, osmMapBundle);
    }
    // Always call the superclass so it can save the view hierarchy state
    super.onSaveInstanceState(savedInstanceState);
}
 
開發者ID:RSDT,項目名稱:Japp16,代碼行數:23,代碼來源:JappMapFragment.java

示例11: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.location_fragment, container, false);

    mMapView = (MapView) rootView.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);

    mMapView.onResume(); // needed to get the map to display immediately

    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    mMapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap mMap) {
            googleMap = mMap;
            refreshMap(null);
        }
    });

    return rootView;
}
 
開發者ID:gautamgitspace,項目名稱:CellularNetworkMonitor,代碼行數:26,代碼來源:MapFragment.java

示例12: getView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
/**
 * Manages creating or re-using the ViewHolder for each grid item.
 */
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {
        convertView = ((LayoutInflater) mContext.getSystemService(
                Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.grid_item, null);
        holder = new ViewHolder();
        holder.mapView = (MapView) convertView.findViewById(R.id.grid_item);
        convertView.setTag(holder);
        holder.initializeMapView();
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    SnazzyMapsStyle style = (SnazzyMapsStyle) getItem(position);
    holder.mapView.setTag(style);
    if (holder.map != null) {
        initializeMap(holder.map, style);
    }

    return convertView;
}
 
開發者ID:stephenmcd,項目名稱:snazzymaps-browser,代碼行數:27,代碼來源:GridAdapter.java

示例13: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
  View root = inflater.inflate(R.layout.fragment_detail_location, container, false);

  mMapView = (MapView) root.findViewById(R.id.mapView);

  mMapView.onCreate(savedInstanceState);
  mMapView.onResume();

  recycleView = (RecyclerView) root.findViewById(R.id.location_recycler_view);

  locationAdapter = new LocationAdapter(getActivity());
  recycleView.setAdapter(locationAdapter);
  recycleView.setLayoutManager(new LinearLayoutManager(getActivity()));

  return root;
}
 
開發者ID:nvh0412,項目名稱:dealhunting,代碼行數:19,代碼來源:DetailLocationFragment.java

示例14: onCreateView

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.fragment_map_search, container, false);
  ButterKnife.bind(this, view);

  unWrapBundle(savedInstanceState);

  // http://stackoverflow.com/questions/13900322/badparcelableexception-in-google-maps-code
  if (savedInstanceState != null) {
    savedInstanceState.remove(BundleKeys.STOPS);
  }

  // initialize the map!
  googleMapView = ((MapView) view.findViewById(R.id.search_google_maps));
  googleMapView.onCreate(savedInstanceState);
  googleMapView.getMapAsync(this);

  return view;
}
 
開發者ID:eleith,項目名稱:calchoochoo,代碼行數:20,代碼來源:MapSearchFragment.java

示例15: init

import com.google.android.gms.maps.MapView; //導入依賴的package包/類
@Override
public void init() {
    super.init();

    mMapView = (MapView) findViewById(R.id.map);
    mMapHelper = new MapHelper(getMainActivity());

    if (mMapView != null) {
        mMapView.onCreate(null);
        mMapView.getMapAsync(mMapHelper);
    }

    txtLatitude = (TextView) findViewById(R.id.txtLatitude);
    txtLongitude = (TextView) findViewById(R.id.txtLongitude);
    txtMapGPS = (TextView) findViewById(R.id.txtMapGPS);
    txtMapGPSSatsInView = (TextView) findViewById(R.id.txtMapGPSSatsInView);
}
 
開發者ID:MarcProe,項目名稱:lp2go,代碼行數:18,代碼來源:ViewControllerMap.java


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