android-mapview

Google map not show any thing in map

可紊 提交于 2019-11-28 01:46:21
问题 i am showing a map in activity ... but when i run app on device it does not show any thing , it show just white screen and zoom in zoom out options... MAP key is right .. thanks .. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.edxample.finalmap" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <permission android:name="com

Adding a KML layer to an Android maps application

≡放荡痞女 提交于 2019-11-28 01:40:58
问题 I have been starting out in the world of Android development recently and I am working on an application which shows a map using the Google API SDK, it is pretty much the original example but edited a little bit. It works a treat but I wish to do more with it. My question is: How do you add a KML layer to this? I've not found many examples out there and none of them are very clear. I know how to do this with Javascript on websites but not in android. Can anyone help? 回答1: Google added a

Mapview getLatitudeSpan and getLongitudeSpan not working

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:14:05
Sometimes when trying to get the Latitude span or Longitude span of a mapview with getLatitudeSpan() and getLongitudeSpan() I get 0 and 360*1E6 respectively. This doesn't happen always but it is a problem, has anybody got this problem? Any workarounds? I tried using getProjection() too but I get the same problem. Here is the piece of code: MapView mapView = (MapView) findViewById(R.id.mapview); int lat = mapView.getLatitudeSpan(); // sometimes returns 0 int long = mapView.getLongitudeSpan(); // sometimes returns 360*1E6 I would detect the condition and schedule your work to try again after a

Android MapView getMap() returns null

為{幸葍}努か 提交于 2019-11-27 23:15:21
问题 MapView 's getMap() method can return null. I know this is an intended behavior by Google. Can someone provide a definitive description as to when and under which circumstances the getMap() method returns null? I know that if Google Services are unavailable on the given device, getMap() will return null. This eventuality is relatively well documented. I'm more concerned with the vague other case where even when Google Services are installed on a device, getMap() can still return null. My

Why do 9-patch graphics size correctly in the emulator but not on a phone?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 23:09:51
I have a RelativeLayout that has a 9-patch background image. The image is a simple speech bubble with a perfectly centered "arrow" at the bottom middle. The RelativeLayout is inflated and placed on a MapView. Using the emulator, the speech bubble can be easily pointed to a location and will expand to its contents (text, an image, or both). When I run my app on a phone however, the 9-patch doesn't stretch properly. The "arrow" for the speech bubble will be offset to the left by a very noticeable amount. I primarily test on a Nexus S, but also a Samsung Captivate and Nexus One. Targeting SDK 7.

How to use Android ViewSwitcher?

我的梦境 提交于 2019-11-27 21:51:24
问题 I'm trying to use the ViewSwitcher to perform switches between two views. One is an ImageView and the other is a MapView. I have a button which the user clicks to perform this switch but my codes are causing an error. Do you guys have any idea what's about? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <relativelayout android

Android Rotating MapView

限于喜欢 提交于 2019-11-27 20:19:19
I am creating an application which trakcs down users path on a mapview. What I want to achieve when user takes a left turn for instance map should rotate it self in such a way that the head of the mapview should always point to upward direction. I hope that makes sense. I came across Mr. Romain Guy's post an he says I have done this in the past and it requires to create a custom ViewGroup that rotates the Canvas in the dispatchDraw() method. You also need to increase the size of the MapView (so that it draws enough pixels when rotated.) You will also need to rotate the touch events in

Placing Zoom Controls in a MapView

扶醉桌前 提交于 2019-11-27 19:56:23
问题 I'm trying to get the zoom controls to show up in a mapview , the following code almost works, but the zoom controls appear in the top left of the mapview , not the bottom center like I'm specifying via setGravity() . Can someone enlighten me as to what I'm missing? zoomView = (LinearLayout) mapView.getZoomControls(); zoomView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT)); zoomView.setGravity(Gravity.BOTTOM | Gravity

How can I determine if a geopoint is displayed in currently viewable area?

*爱你&永不变心* 提交于 2019-11-27 19:11:27
Say I have mapview control in my Android app. If I know a landmark exists at a certain latitude and longitude, how can I determine if that landmark is currently viewable on the user's screen? Is there a method for getting the coordinates for the top left and bottom right corners of the visible area? skyman You can project GeoPoint to Point and check if it is box (0, screen width) by (0, screen height) See: https://developer.android.com/reference/com/google/android/gms/maps/Projection.html Something like this will do the trick. private boolean isCurrentLocationVisible() { Rect

How can I draw an Arrow showing the driving direction in MapView?

廉价感情. 提交于 2019-11-27 18:53:02
I use that Google Maps component MapView in an Android application. I can use the GPS location to show my location with a dot. But I would like to show an arrow instead, that points out the driving direction (bearing). I think that I can use the bearing value to get the angle of the arrow. How can I do that? pheelicks Assuming you've got the Location then obtain the bearing by doing: float myBearing = location.getBearing(); To implement the overlay you'll be using ItemizedOverlay and OverlayItem . You'll need to subclass OverlayItem to add the functionality to rotate the Drawable. Something