android-mapview

Android: How do I set the zoom level of map view to 1 km radius around my current location?

☆樱花仙子☆ 提交于 2019-11-26 07:58:56
问题 I want to set the map view zoomed to 1km radius but cant figure out how? The doc says that the zoom level 1 will map earths equator to 256 pixels. So how do I calculate which zoom level I need to set so that the map view shows area in 1KM radius? UPDATE: After reading a few blog posts I wrote the following code: private int calculateZoomLevel() { double equatorLength = 6378140; // in meters double widthInPixels = screenWidth; double metersPerPixel = equatorLength / 256; int zoomLevel = 1;

How do you draw text with a border on a MapView in Android?

爷,独闯天下 提交于 2019-11-26 07:58:07
问题 I\'m trying to draw some text onto an MapView on Android. The drawing of the text goes fine, but it\'s very hard to read the text because it\'s white with no black border (like the rest of the text that appears naturally on MapViews to denote cities, states, and countries). I can\'t seem to figure how to draw the text with a black border. Anyone know how to do this? This is the sort of code I\'m using right now (this is just example code, found in one of my overlays): @Override public void

Android Geocoder getFromLocationName always returns null

Deadly 提交于 2019-11-26 07:42:19
问题 I have been trying to geocode a string to get its coordinates but my program always crashes because when ever I try to use getFromLocationName() it returns null . I have been trying to fix this for hours but nothing is working. Here is my code public class MainActivity extends Activity { private GoogleMap mMap; List<Address> addresses; MarkerOptions miami; String myLocation = \"Miami,Florida\"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to handle onTouch event for map in Google Map API v2?

ぃ、小莉子 提交于 2019-11-26 06:40:58
问题 GoogleMap by default doesn\'t provide event for map drag start and drag stop. I have already reported that problem here. I want to make custom handler that will use plain onTouch event and combine it with setOnCameraChangeListener . However i failed to find how I can access onTouch event of GoogleMap object. It doesn\'t provide such callback . I wonder how can i handle onTouch event for map in Google Map API v2 ? 回答1: Here is a possible workaround for determining drag start and drag end

How to display Toast in Android?

允我心安 提交于 2019-11-26 05:37:14
I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I touch, a AsyncTask is fired up, it downloads some data and makes a Toast that displays the data. Although I start the task on touch event no toast is displayed, not till I close the slider. When the slider is closed and the map is not displayed anymore the Toast appears. Any ideas? Well start the task EDIT: public boolean onTouchEvent(MotionEvent event, MapView mapView){ if (event.getAction() == 1)

One Google Maps key for all developers?

纵然是瞬间 提交于 2019-11-26 04:50:41
问题 We are using a Google MapView in our application but on different computers we must use different API keys, otherwise the MapView doesn\'t display anything. Is there a way to set one key for all developers? 回答1: Is there a way to set one key for all developers? For the debug signing key, copy your debug keystore (e.g., ~/.android/debug.keystore ) between developer PCs, and remember to update all of them again when that keystore expires. For the production signing key, copy the production

How to use multiple MapActivities/MapViews per Android application/process

心已入冬 提交于 2019-11-26 04:46:46
问题 I have written one MapActivity class that is able to display a set of places as well as single places. On startup, the application creates an instance of this MapActivity and displays multiple places. If the user clicks on a certain place, then a new Activity is launched that shows the details of the selected place. This activity has a menu item that allows the user to view the place on a map - this causes that a new instance of the MapActivity is created, except that now only this single

How to display Toast in Android?

∥☆過路亽.° 提交于 2019-11-26 01:55:25
问题 I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I touch, a AsyncTask is fired up, it downloads some data and makes a Toast that displays the data. Although I start the task on touch event no toast is displayed, not till I close the slider. When the slider is closed and the map is not displayed anymore the Toast appears. Any ideas? Well start the

Capture screen shot of GoogleMap Android API V2

走远了吗. 提交于 2019-11-26 01:47:12
问题 Final Update The feature request has been fulfilled by Google. Please see this answer below. Original Question Using the old version of the Google Maps Android API, I was able to capture a screenshot of the google map to share via social media. I used the following code to capture the screenshot and save the image to a file and it worked great: public String captureScreen() { String storageState = Environment.getExternalStorageState(); Log.d(\"StorageState\", \"Storage state is: \" +

Drawing a line/path on Google Maps

妖精的绣舞 提交于 2019-11-26 01:22:30
问题 I\'ve been busy for a long time finding out how to draw a line between two (GPS) points on the map in HelloMapView but with no luck. Could anyone please tell me how to do so. Suppose I use the HelloMapView which extends MapView. Do I need to use overlays? If so do I have to override the onDraw() method of the overlay and draw a line here? I actually tried these things but with no result. Thank you in advance! 回答1: Thank you for your help. At last I could draw a line on the map. This is how I