当前位置: 首页>>代码示例>>Java>>正文


Java MapView.getMap方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.MapView.getMap方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.getMap方法的具体用法?Java MapView.getMap怎么用?Java MapView.getMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.MapView的用法示例。


在下文中一共展示了MapView.getMap方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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.location_fragment, container, false);
    // Gets the MapView from the XML layout and creates it
    mapView = (MapView) view.findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);

    // Gets to GoogleMap from the MapView and does initialization stuff
    map = mapView.getMap();
    map.getUiSettings().setMyLocationButtonEnabled(false);
    map.setMyLocationEnabled(true);

    // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
    MapsInitializer.initialize(this.getActivity());
    map.setOnMarkerDragListener(this);

    mNetworkConnection = new NetworkConnection(getActivity());
    mLocationProvider = new LocationProvider(getActivity(), this);

    return view;
}
 
开发者ID:mojo1643,项目名称:margarita,代码行数:23,代码来源:LocationFragment.java

示例2: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

	setActionBar();
	View view = inflater.inflate(R.layout.fragment_security, container, false);

	autoBlip = (ToggleButton) view.findViewById(R.id.toggle_blip);
	autoLocate = (ToggleButton) view.findViewById(R.id.toggle_locate);
	wipe = (Button) view.findViewById(R.id.wipe);
	wipeCache = (Button) view.findViewById(R.id.wipe_cache);

	mapView = (MapView) view.findViewById(R.id.mapView);
	mapView.onCreate(savedInstanceState);
	mapView.onResume();
	try {
		MapsInitializer.initialize(getActivity().getApplicationContext());
	} catch (Exception e) {
		e.printStackTrace();
	}
	map = mapView.getMap();
	setupMap();

	setupListeners();
	return view;
}
 
开发者ID:rachitmishra,项目名称:ceeq,代码行数:26,代码来源:SecurityFragment.java

示例3: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.map_view, container,
            false);

    mProgressView = v.findViewById(R.id.map_progress);
    mProgressView.setVisibility(View.VISIBLE);

    mMapView = (MapView) v.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);
    mMapView.onResume();// needed to get the map to refresh immediately

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

    googleMap = mMapView.getMap();
    googleMap.getUiSettings().setScrollGesturesEnabled(false);

    initMap();

    return v;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:28,代码来源:AgentInterventionMapFragment.java

示例4: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    // inflat and return the layout
    View v = inflater.inflate(R.layout.map_view, container,
            false);

    mProgressView = v.findViewById(R.id.map_progress);
    mProgressView.setVisibility(View.VISIBLE);

    mMapView = (MapView) v.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);
    mMapView.onResume();// needed to get the map to refresh immediately

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

    googleMap = mMapView.getMap();

    initMap();

    return v;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:28,代码来源:MapListInterventionsFragment.java

示例5: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // inflate and return the layout
    View v = inflater.inflate(R.layout.map_view, container, false);
    mMapView = (MapView) v.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);

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

    // Initialize Google Map
    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    // get the googleMap
    googleMap = mMapView.getMap();

    PlanZoneActivity activity = (PlanZoneActivity) getActivity();

    // Center the camera on the intervention position
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(new LatLng(activity.getIntervention().getLatitude(), activity.getIntervention().getLongitude())).zoom(16).build();
    googleMap.animateCamera(CameraUpdateFactory
            .newCameraPosition(cameraPosition));

    initMap(activity.getIntervention().getWatchPath());

    this.dronesMarkers = new HashMap<>();
    return v;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:35,代码来源:PlanZoneMapFragment.java

示例6: 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 v = inflater.inflate(R.layout.fragment_detail_store, container, false);

    // Gets the MapView from the XML layout and creates it
    mapView = (MapView) v.findViewById(R.id.myMapStore);
    mapView.onCreate(savedInstanceState);

    MapsInitializer.initialize(getActivity());

    googleMap = mapView.getMap();
    mapHelper = new MyGoogleMapHelper(googleMap);
    mapHelper.initializeMapTwo();
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "GillSans.ttc");

    TextView txtTitle = (TextView) v.findViewById(R.id.txtTitleStore);
    txtTitle.setTypeface(tf);
    txtTitle.setText(coupon.getStore());

    TextView txtSummary = (TextView) v.findViewById(R.id.txtStoreDetailStore);
    txtSummary.setTypeface(tf);
    txtSummary.setText("");

    ImageView imgView = (ImageView) v.findViewById(R.id.imageViewDetailStore);
    imgView.setImageResource(coupon.getImageRes());

    mapHelper.zoomMap(new LatLng(coupon.getLat(), coupon.getLng()));
    mapHelper.setMarker(coupon.getLat(), coupon.getLng(), coupon.getImageMarker_s(), coupon.getStore());

    return v;
}
 
开发者ID:oSoc14,项目名称:mv_geomarketing_android,代码行数:34,代码来源:DetailStoreFragment.java

示例7: setup

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
private void setup() {
    mSheetAdapter = new EntriesRecyclerAdapter(mainActivity.entries);

    mapView = (MapView) mRoot.findViewById(R.id.mapView);
    mapView.setAlwaysDrawnWithCacheEnabled(true);
    mapView.setPersistentDrawingCache(MapView.PERSISTENT_ALL_CACHES);
    mapView.onCreate(null);

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

    map = mapView.getMap();

    mClusterManager = new ClusterManager<EntryMarker>(getActivity(), map);
    map.setOnCameraChangeListener(mClusterManager);
    map.setOnMarkerClickListener(mClusterManager);

    mClusterManager.setOnClusterClickListener(this);
    mClusterManager.setOnClusterItemClickListener(this);

    onDataUpdated();

    if (ActivityCompat.checkSelfPermission(mainActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mainActivity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        map.setMyLocationEnabled(false);

        if ( getActivity() != null && getActivity().getSystemService(Context.LOCATION_SERVICE) != null) {
            String locationProvider = LocationManager.NETWORK_PROVIDER;
            LocationManager mLocationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
            lastKnownLocation = mLocationManager.getLastKnownLocation(locationProvider);
        }

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if ( !isAdded() )
                    return;

                if ( lastKnownLocation != null ) {
                    LatLng position = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
                    CameraPosition newPosition = CameraPosition.fromLatLngZoom(position, 12.0f);
                    map.animateCamera(CameraUpdateFactory.newCameraPosition(newPosition));
                }

            }
        }, 500);
    }
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:51,代码来源:PlacesFragment.java

示例8: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // inflate and return the layout
    View v = inflater.inflate(R.layout.map_view, container, false);
    mMapView = (MapView) v.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);

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

    // Initialize Google Map
    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    // get the googleMap
    googleMap = mMapView.getMap();

    activity = (VisualisationActivity) getActivity();
    inter = activity.getIntervention();

    this.pathList = activity.getIntervention().getWatchPath();
    this.polylines = new ArrayList<>();
    this.markers = new ArrayList<>();
    this.dronesMarkers = new HashMap<>();

    new Handler().postDelayed(new Runnable()
    {
        @Override
        public void run()
        {
            if(googleMap != null && mBounds != null)
                googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mBounds, 50));
        }
    }, 500);

    return v;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:42,代码来源:VisualisationMapFragment.java

示例9: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    Bundle args = getArguments();
    locations = args.getDoubleArray("locations");
    crimeInfo = args.getStringArray("info");
    // Retrieve locations & crime info from main activity

    double latitude;
    double longitude;
    // Initialize variables

    // inflate and return the layout
    View v = inflater.inflate(R.layout.activity_map_fragment, container,
            false);
    mMapView = (MapView) v.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();
    }

    googleMap = mMapView.getMap();

   // currentLocationIcon = BitmapDescriptorFactory.fromResource(R.drawable.map_icon);

    int j = 0;
    for (int i = 0; i < locations.length; i += 2) {
        // latitude and longitude
        latitude = locations[i];
        longitude = locations[i + 1];

        if (Double.compare(locations[i], -1.0) != 0)
        {
            // This means valid lat & long were found for address

            // create marker
            MarkerOptions marker = new MarkerOptions().position(
                    new LatLng(latitude, longitude)).title(crimeInfo[j]);

            BitmapDescriptorFactory.fromResource(R.drawable.map_icon);
            // Initialize BitmapDescriptorFactory

            // Changing marker icon
            marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ROSE));

            // adding marker
            googleMap.addMarker(marker);
        }
        j++;
    }


    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(new LatLng(40.006329, -83.016880)).zoom(12).build();
    // Zoom into campus area

    googleMap.animateCamera(CameraUpdateFactory
            .newCameraPosition(cameraPosition));

    // Perform any camera updates here

    return v;
}
 
开发者ID:CailinPitt,项目名称:AwareOSUAndroid,代码行数:70,代码来源:MapFragment.java

示例10: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);

    View view = inflater.inflate(R.layout.map_view, container, false);

    mapView = (MapView) view.findViewById(R.id.map);

    mapView.onCreate(savedInstanceState);

    if(mapView!=null) {
        googleMap = mapView.getMap();

        googleMap.getUiSettings().setMyLocationButtonEnabled(true);

        googleMap.setMyLocationEnabled(true);

        googleMap.getUiSettings().setZoomControlsEnabled(true);

        googleMap.getUiSettings().setTiltGesturesEnabled(true);

    }

    return view;
}
 
开发者ID:mrebordinos,项目名称:TigreApp,代码行数:26,代码来源:FotosMapFragment.java

示例11: 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
        // Gets the MapView from the XML layout and creates it
        View v = inflater.inflate(R.layout.fragment_gmap, container, false);
        mapView = (MapView) v.findViewById(R.id.mapview);
        mapView.onCreate(savedInstanceState);
        metrics = MyApplication.getInstance().getMetrics();
        // Gets to GoogleMap from the MapView and does initialization stuff

        map = mapView.getMap();
        map.getUiSettings().setMyLocationButtonEnabled(true);
        map.setMyLocationEnabled(true);
        map.getUiSettings().setAllGesturesEnabled(true);
        map.getUiSettings().setCompassEnabled(true);
        map.getUiSettings().setMapToolbarEnabled(true);
        map.getUiSettings().setZoomControlsEnabled(true);
        map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
            @Override
            public boolean onMarkerClick(Marker marker) {
                Dialog builder = new Dialog(getActivity());

                // builder.requestWindowFeature(Window.FEATURE_NO_TITLE);
                builder.setTitle(titles[Integer.parseInt(marker.getSnippet())]);

                builder.getWindow().setBackgroundDrawable(new ColorDrawable(Color.WHITE));
                String durl = urls[Integer.parseInt(marker.getSnippet())].replace("square", "medium");
                ImageView imageView = new ImageView(getActivity());

                //imageView.setDefaultImageResId(com.google.android.gms.maps.R.drawable.powered_by_google_light);

                //imageView.setImageUrl(durl, VolleySingleton.getInstance().getImageLoader());
                Picasso.with(mContext).load(durl).into(imageView);
                builder.addContentView(imageView, new RelativeLayout.LayoutParams(
                        metrics.widthPixels,
                        metrics.widthPixels));
                imageView.bringToFront();
                builder.show();
//                YoYo.with(Techniques.Hinge)
//                        .duration(500)
//                        .playOn(imageView);
                return false;
            }
        });
        // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
        MapsInitializer.initialize(this.getActivity());
        Location l = MyApplication.getInstance().getMyLocation();
        // Updates the location and zoom of the MapView
        CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(l.getLatitude(), l.getLongitude()), 9);
        map.animateCamera(cameraUpdate);

        return v;
    }
 
开发者ID:hemant3370,项目名称:Picoroid,代码行数:55,代码来源:GmapFragment.java

示例12: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         rootView = inflater.inflate(R.layout.fragment_home, container, false);
         dropMap = new HashMap<Marker, Drop>();
         
         if(!isConnected()) {
         	new AlertDialog.Builder(rootView.getContext())
         		.setTitle("No Connection")
         		.setIcon(android.R.drawable.ic_dialog_alert)
         		.setMessage("Internet not available. You will not be able to see drops. Please check your connectivity and then refresh or reload Drop In.")
         		.setNeutralButton("OK", new DialogInterface.OnClickListener() {
         			@Override
         			public void onClick(DialogInterface dialog, int which) { }
         		})
         		.show();
         }
     	
         // get MapView from layout
         mapView = (MapView) rootView.findViewById(R.id.mapview);
         mapView.onCreate(savedInstanceState);
         //get GoogleMap from MapView + initialization
         map = mapView.getMap();
         MapsInitializer.initialize(mapView.getContext());
         map.setMyLocationEnabled(true);

         int actionBarSize = getActionBarHeight();
         map.setPadding(0, actionBarSize, 0, actionBarSize);
         
         map.getUiSettings().setZoomControlsEnabled(true);
         
         refresh();
     	
     	map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
	@Override
	public void onInfoWindowClick(Marker marker) {
		info = new Info_Fragment(dropMap.get(marker));
		ft = fm.beginTransaction();
		ft.add(R.id.container, info)
		  .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
		  .addToBackStack("info")
		  .commit();
	}
});
         
         return rootView;
     }
 
开发者ID:valesken,项目名称:BecauseWaterAndroid,代码行数:47,代码来源:HomeActivity.java

示例13: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        setHasOptionsMenu(true);

        View rootView = inflater.inflate(R.layout.home_view, container, false);

        ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.app_name);

        mapView = (MapView) rootView.findViewById(R.id.map);

        mapView.onCreate(savedInstanceState);

        if(mapView!=null) {
            googleMap = mapView.getMap();

            googleMap.getUiSettings().setMyLocationButtonEnabled(true);

            googleMap.setMyLocationEnabled(true);

            googleMap.getUiSettings().setZoomControlsEnabled(true);

            googleMap.getUiSettings().setTiltGesturesEnabled(true);

//            drawLine();
        }

        btnInitRuta = (LinearLayout)rootView.findViewById(R.id.new_ruta);
        btnFinishRuta = (LinearLayout)rootView.findViewById(R.id.finish_ruta);
        LinearLayout btnTakePhoto = (LinearLayout)rootView.findViewById(R.id.take_photo);
        btnInitRuta.setOnClickListener(this);
        btnFinishRuta.setOnClickListener(this);
        btnTakePhoto.setOnClickListener(this);

        fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
        fab.setOnClickListener(this);

        return rootView;
    }
 
开发者ID:mrebordinos,项目名称:TigreApp,代码行数:39,代码来源:HomeFragment.java

示例14: onCreateView

import com.google.android.gms.maps.MapView; //导入方法依赖的package包/类
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        setHasOptionsMenu(true);

        View view = inflater.inflate(R.layout.map_view, container, false);

        String title = getArguments().getString("title");
        rutaId = getArguments().getInt("idruta");

//        ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(title);

        mapView = (MapView) view.findViewById(R.id.map);

        mapView.onCreate(savedInstanceState);

        if(mapView!=null) {
            googleMap = mapView.getMap();

            googleMap.getUiSettings().setMyLocationButtonEnabled(true);

            googleMap.setMyLocationEnabled(true);

            googleMap.getUiSettings().setZoomControlsEnabled(true);

            googleMap.getUiSettings().setTiltGesturesEnabled(true);

        }

        return view;
    }
 
开发者ID:mrebordinos,项目名称:TigreApp,代码行数:31,代码来源:RutaViewFragment.java


注:本文中的com.google.android.gms.maps.MapView.getMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。