android-maps-v2

Adding markers from url with Picasso

﹥>﹥吖頭↗ 提交于 2019-12-10 03:54:37
问题 I'm adding markers to my map from a url using the Picasso library As a marker isn't an ImageView I tried to use a Target instead for(int x =0; x < mapIcon_url.length; x++){ Picasso.with(getActivity()).load(mapIcon_url[x]).resize(marker_size, marker_size+15).into(new Target() { @Override public void onSuccess(Bitmap b) { bitmapMarker = BitmapDescriptorFactory.fromBitmap(b); //create marker option if(b != null) markerOptions = new MarkerOptions().position(marker_position).icon(bitmapMarker));

Set map marker to a custom color Android

强颜欢笑 提交于 2019-12-10 03:32:08
问题 I am making an app that adds pins to a map at certain points. I want the color of my pins to match the theme colors of our app. Sorry I'm really a noob int color = Color.rgb(255, 201, 14); mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); final LatLng PERTH = new LatLng(40, -80); Marker perth = mMap.addMarker(new MarkerOptions() .position(PERTH) .title("MY PIN") .snippet("MAGGIE EATS SNAKE SKINS") .draggable(true) .icon(BitmapDescriptorFactory.fromResource(R

android google map marker placing

穿精又带淫゛_ 提交于 2019-12-09 16:23:57
问题 In my Android application I need to place marker at exact position on map. I pin a marker on map with 51.507351, -0.127758 (London) location. I used the following code to do the work. googleMap.addMarker(new MarkerOptions().position( new LatLng(51.507351, -0.127758)).icon( BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(), R.drawable.q_icon)))); googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom( new LatLng(51.507351, -0.127758), 20)); And this my marker

Google Maps v2 Projection.toScreenLocation(…) extremely slow

依然范特西╮ 提交于 2019-12-09 11:05:34
问题 I have upgraded Google Maps v1 to v2 in my Android application. And v2 was nice and so on BUT one method seems to be the slowest thing in my life. Projection proj = map.getProjection(); Point point = proj.toScreenLocation(example.m_geopoint); toScreenLocation(...) is so slow so the application slow downs to unusable slowmotion. The method updated maybe 100 times per frame but that works very very great on Google Maps v1. And when I check in Android Console I see this: 10-06 13:53:04.460: D

New gms.maps.MapView rendering lags a bit when in a ListView?

我的未来我决定 提交于 2019-12-09 05:58:05
问题 I'm trying to put an instance of the new MapView in a ListView. New mapview being: com.google.android.gms.maps.MapView I'm turning all interactions off, and setting a fixed height for the view: GoogleMapOptions options = new GoogleMapOptions(); options.mapType(GoogleMap.MAP_TYPE_NORMAL); options.compassEnabled(false); options.rotateGesturesEnabled(false); options.scrollGesturesEnabled(false); options.tiltGesturesEnabled(false); options.zoomControlsEnabled(false); options.zoomGesturesEnabled

Google maps not showing on android in release mode

非 Y 不嫁゛ 提交于 2019-12-08 19:10:30
问题 I am trying to release my app, but having a problem with google maps. The app contains an activity (MapActivity) that displays a map. When running in debug mode, the map works fine. I signed my app in release mode, and got SHA1. I created a new android key on Google console as required (SHA1;packageName). Got the API Key In my App, I referenced a copy of google-play-services-lib as required. I am using ADT. map.xml <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas

SecurityException when calling getLastKnownLocation

孤者浪人 提交于 2019-12-08 16:01:03
问题 We've been getting reports of crashes on some devices when a user opens an Activity that calls the location manager's getLastKnownLocation method. We've requested all the required permissions in our application manifest: <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> Here is the stack trace: java.lang.RuntimeException: Unable to resume activity {com.projectname/com.projectname.ui

Android setOnMyLocationChangeListener is deprecated

爷,独闯天下 提交于 2019-12-08 14:42:17
问题 Android Google Map's setOnMyLocationChangeListener method is now deprecated. Does anyone know how to go around it? Thanks. 回答1: setOnMyLocationChangeListener method is Deprecated now. You can use com.google.android.gms.location.FusedLocationProviderApi instead. FusedLocationProviderApi which is the latest API and the best among the available possibilities to get location in Android. 回答2: FusedLocationProviderApi is now deprecated too. Try FusedLocationProviderClient. 来源: https://stackoverflow

MapView in android application

99封情书 提交于 2019-12-08 13:36:15
问题 I am trying include google map in my android application. I gone through this procedure to get the Map API key. After getting the key i wrote the following code to display the map in my application. My Manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mymap" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" /> <uses-permission

How to get total travelled distance and route from google map directions api like uber

微笑、不失礼 提交于 2019-12-08 13:11:46
问题 How to get total travelled distance and route from google map directions API to show user travelled path like Uber. 回答1: You can use the Google Maps Distance Matrix API that provides travel distance and time for a matrix of origins and destinations. It returns information based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair. A Google Maps Distance Matrix API request takes