android-maps

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

柔情痞子 提交于 2019-12-03 08:11:18
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(false); mMapView = new MapView(getActivity(), options); mMapView.setLayoutParams(new AbsListView

How to launch map intent with a marker/overlay item at given latitude and longitude?

♀尐吖头ヾ 提交于 2019-12-03 07:52:52
问题 I have a latitude and longitude and I want to open google maps centred at that point. So i use the following code for it: Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:"+lat +","+lng)); startActivity(intent); However, this does not place a marker on the center. I want to place some kind of marker at the the point I start with (and optionally some kind of name for it). Any idea how this can be achieved? 回答1: You can use it like, Showing Particular Place, Uri uri

Google Maps API v2: LatLngBounds from CameraPosition

有些话、适合烂在心里 提交于 2019-12-03 02:36:51
问题 Is there a simple way to get the LatLngBounds of the visible map from a CameraPosition with Android Google Maps API v2 so that I can use the OnCameraChangeListener to go fetch new data for the markers. mMap.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition position) { LatLngBounds bounds = ?; fetchNewData(bounds); } }); 回答1: Update since August 2016 Summary the correct answer now for this problem is to use the new onCameraIdle ,

Unable to start activity caused by NullPointerException at ContextImpl.openFileOutput

情到浓时终转凉″ 提交于 2019-12-02 20:57:41
问题 I've released an app which uses the Android Compatibility Library for Google Maps (https://github.com/petedoyle/android-support-v4-googlemaps) and I've received some odd "Unable to start activity" crash reports. I've pasted a couple of sample stack traces below. Anyone else experienced this using the Android Compatibility Library for Google Maps or even using the standard Android Compatibility Library (http://developer.android.com/sdk/compatibility-library.html)? Anyone know how I might be

Google Maps API v2: LatLngBounds from CameraPosition

怎甘沉沦 提交于 2019-12-02 16:11:21
Is there a simple way to get the LatLngBounds of the visible map from a CameraPosition with Android Google Maps API v2 so that I can use the OnCameraChangeListener to go fetch new data for the markers. mMap.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition position) { LatLngBounds bounds = ?; fetchNewData(bounds); } }); Update since August 2016 Summary the correct answer now for this problem is to use the new onCameraIdle , instead of OnCameraChangeListener , which is now deprecated . Read bellow how. Now you can listen to "dragEnd"

OnClickListener for pushpin

风格不统一 提交于 2019-12-02 12:13:46
Here I have used google map and an overlay. I have used an image of pushpin to point to the GeoPoint. I want to set an OnClickListener event for the push pin. When user touches the pin, I want to toast a message. Below is the code. import java.util.List; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Point;

Can GeoCoder getFromLocation method cause a NetworkOnMainThreadException to be thrown?

喜夏-厌秋 提交于 2019-12-02 02:35:10
I have an app which was tested thoroughly and working fine on Android Gingerbread (and older Android versions). I've noticed from users' reported crash errors that phones running later versions of the Android operating system are throwing a NetworkOnMainThreadException . I'm trying to work through my code and eliminate/fix all culprits. Would the GeoCoder getFromLocation and getFromLocationName methods throw a NetworkOnMainThreadException if called from the main/ui thread? Seems like these Geocoder methods and any networking or i/o calls are going to throw up a NetworkOnMainThreadException .

How do I draw a KML file on a MapView in Android?

好久不见. 提交于 2019-12-02 01:26:41
I have to draw a KML file into a MapView. I looked in the internet but I didn't find an example how to do it, if someone can give an example how to do it it wil be great! Ilya Demidov KML is not supported now. You can draw trace like that w/o KML : 1) Make request to Google service : Request : http://maps.googleapis.com/maps/api/directions/output?parameters Info about : https://developers.google.com/maps/documentation/directions/ 2) Send request 3) Parsing JSON response like this : JSONObject jsonObject; ... JSONArray results = jsonObject.optJSONArray("routes"); JSONObject route = results

Difference between public final void moveCamera (CameraUpdate update) and public final void animateCamera (CameraUpdate update)?

橙三吉。 提交于 2019-12-01 20:02:38
What is the difference between the methods public final void moveCamera (CameraUpdate update) and public final void animateCamera (CameraUpdate update) of GoogleMap class? When should I call getCameraPosition()? The difference between those two is that: animateCamera will animate the camera to the desired position with a smooth animation, while moveCamera will move the camera to the desired position instantly. Edit: From the docs of CameraPosition : An immutable class that aggregates all camera position parameters. basicly it contains all the data of the camera position like: bearing, tilt,

Google map not showing when app is downloaded from playstore but showing fine when installed directly signed apk

a 夏天 提交于 2019-12-01 15:55:38
I am facing an issue in google map.Google map is not showing when I download the apk from google play store but it works fine when I manually install(by transferring to device) same apk which was uploaded to play store. I have rechecked my debug and release keys which are present here Please find permission in manifest file: <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.USE_FINGERPRINT" /> <uses-permission android:name="android.permission