当前位置: 首页>>代码示例>>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;未经允许,请勿转载。