android-mapview

Android, How to add Google map options from XML layout?

浪尽此生 提交于 2019-12-23 10:04:40
问题 I have a fragment that holds a MapView. I have added this view in XML file like this: <?xml version="1.0" encoding="utf-8"?> <com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" map:uiCompass="true" android:background="#00000000" /> And I've linked it to my code like this:

Why getHandler() returns null?

时间秒杀一切 提交于 2019-12-23 07:36:41
问题 I have got following problem. I'm drawning route on mapview in separate thread like this: public void drawRoute(final MapView mapView) { new Thread(new Runnable() { public void run() { try { //Do something useful } catch (SomeException se) { Handler handler = mapView.getHandler(); handler.post(/*show error in UI thread*/) }} }).start(); } But when I get handler it returns null, although in debug mode handler returned and error message is displayed. What can the problem be? PS May be it's

How to show route on Inbuilt Map in Android Programmatically

那年仲夏 提交于 2019-12-23 06:32:32
问题 After Full day Spending, I Found solution of this Question: How to show route on InBuilt MAP from one current place to another place using longitude/latitude or using Address? May it is helpful to you. 回答1: Create layout file for Button: layout.xml <Button android:id="@+id/showMap" android:layout_width="@dimen/visit_button_width" android:layout_height="wrap_content" android:layout_marginTop="25dp" android:background="@drawable/login_button_selector" android:text="@string/title_show_map"

Is it possible to show terrain maps with Android MapView class

痴心易碎 提交于 2019-12-23 04:04:35
问题 Is it possible to show terrain maps similar to this http://maps.google.com/maps?hl=en&ie=UTF8&ll=45.699466,6.389236&spn=0.327066,0.861053&t=p&z=11 using MapView class? 回答1: You can swap styles of the map with .setSatellite(true or false); true for sattelite map false for road map. This style of map is not supported, yet. 来源: https://stackoverflow.com/questions/6795705/is-it-possible-to-show-terrain-maps-with-android-mapview-class

Map Marker Management, Android

醉酒当歌 提交于 2019-12-23 02:36:26
问题 I have a map that dispays markers. If the user clicks on a marker a popup shows up. A method calculates wheather there is a marker at the clicked position. My Problem is that I have a lot of different markers, but in this method I can handle only one specific marker. I need something like a general bitmap, that holds all marker resources. E.g. I do not wand to handle 100 markers manually, because all are a Bitmap so I need just to handle one general bitmap. any ideas? 回答1: I have solved my

mapView deprecated method getZoomControls?

杀马特。学长 韩版系。学妹 提交于 2019-12-22 16:45:13
问题 I'm trying to get the default zoom controls to show on a google mapView. I was looking at this code. But getZoomControls() is deprecated. I'm trying to use setBuiltInZoomControls instead, but am getting errors; When I debug, the exception is; java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.maptab2/com.test.maptab2.MapTabView}: java.lang.NullPointerException 02-05 09:49:21.239: W/dalvikvm(357): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 02

Android AppWidget maps activity problem

◇◆丶佛笑我妖孽 提交于 2019-12-22 13:47:57
问题 Right. So I have an app widget. It has 4 buttons, one one of the buttons I want it to show me the current location of the user on the map. So - I make a new activity as below: package com.android.driverwidget; import java.util.List; import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.Overlay; public class

How to keep map state on device rotation?

僤鯓⒐⒋嵵緔 提交于 2019-12-22 12:57:13
问题 I have a nested fragment that i would like to maintain the state when the device orientation changed. It is something like this: I'm instantiate a mapView in the nested fragment and when the device is rotated the user must be in the same place where it was. How can I accomplish this? Thank you 回答1: Ok, so i was making a mistake. I was calling the function setRetainInstance(true) on the fragment parent and i shouldn't. After deleting that line, it was very simple to keep the map state on

Programmatically Creating MapView and Adding a Marker Results in a null pointer exception in the fragment

不问归期 提交于 2019-12-22 11:50:13
问题 I am trying to create a MapView programmatically and add a MarkerPosition as shown below: MapView mapView = new MapView(getActivity()); ((ViewGroup) rootView).addView(mapView); GoogleMap googleMap = mapView.getMap(); googleMap.addMarker(new MarkerOptions() .position(new LatLng( Double.parseDouble( mEvent.getEventInfo().mEventData.mLat), Double.parseDouble( mEvent.getEventInfo().mEventData.mLng))) .title("Marker")); Manifest File: <uses-permission android:name="android.permission.ACCESS_COARSE

Mark current location on google map

旧街凉风 提交于 2019-12-22 11:28:46
问题 How to mark my current location on google map? I am using google place API. I have to show all near places from my current position. All places are showing on google map, but how to show my current position? The code is given below: public class PoliceStationMapActivity extends FragmentActivity implements LocationListener { private ArrayList<Place> mArrayListPoliceStations; private GoogleMap mMap; private LocationManager locManager; private double latitude; private double longitude; @Override