android-mapview

Returning a GeoPoint on user touch MapView Android

空扰寡人 提交于 2019-12-11 02:58:02
问题 I'm having trouble trying to figure out a way to return a GeoPoint with the longitude and latitude of the location the user just touched. I have seen and read tons or examples that display the longitude and latitude in a toast by overriding dispatchTouchEvent() . I believe this won't work for my case for the following reason. I want the user to be able click a button that will then call another method that will return a geopoint on the user's next tap. So, in short, a geopoint is only

Why are my overlays on a mapview not shown?

旧时模样 提交于 2019-12-11 02:46:49
问题 I followed the instructions from the google hellomapview tutorial. I get a working mapview etc. But the two items that are added to the map are not shown. It seems they are there somewhere because tapping at the specified location shows the message that was added to the items. Edit Here is my source code. It should be very close to the google tutorial source code. public class MapOverlay extends ItemizedOverlay<OverlayItem> { private List<OverlayItem> overlays = new ArrayList<OverlayItem>();

Android Map Zoom Level for Current Location and Destination

独自空忆成欢 提交于 2019-12-11 02:31:47
问题 I am displaying the user's current position and their intended destination using Google maps, MappingOverlayActivity and ItemizedOverlay. What is the best way to firstly set the appropriate zoom level so that both locations are displayed on the map on the screen with the maximum area covered by the map, i.e rather than the current location being in the centre, having the centre being in the middle of the 2 points.. Also when the user's current location changes, how can I then recalulate and

Android MapView MapController stopAnimation not stopping animation

馋奶兔 提交于 2019-12-11 02:25:07
问题 well, i'm developing a geolocation app in Android. On first run we center the map at the current location, then the user can zoom and pan freedomly, but we have a button that animates the map and centers it back to the actual position. The problem is that this just happens when the map is static: if the user scrolls the map and leaves it scrolling by inertia, this button won't work until the animation is stopped. Here's the code. mapView.getController().stopAnimation(false); //this aint

MapView: Could not find class A referenced from method B

蓝咒 提交于 2019-12-11 02:15:42
问题 There are 3 buttons on the screen! Start, View Map, Stop When I click View Map, it should go to a new screen that shows the map! But something goes wrong and the app is getting force closed! I keep getting Could not find class A referenced from method B error. Please please please someone correct it. I've been struck with this for 3 days!!! :'( Main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical

displaying route path names

丶灬走出姿态 提交于 2019-12-10 22:26:07
问题 //main activity in this class two errors shown below within the comments import android.graphics.Color; import android.os.Bundle; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; public class NewroutepathActivity extends MapActivity { /** Called when the activity is first created. */ MapView mapView; private String US_API; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

osmdroid ItemizedOverlay error: The method boundCenterBottom(Drawable) is undefined for the type

怎甘沉沦 提交于 2019-12-10 17:54:54
问题 I'm struggling for some hours now with this problem: I'm trying to get my itemizedoverlay to work, but I keep getting this error: The method boundCenterBottom(Drawable) is undefined for the type my class: public MyDynamicItemizedOverlay(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); items = new ArrayList<OverlayItem>(); populate(); } public void addNewItem(GeoPoint location, String markerText, String snippet) { items.add(new OverlayItem(snippet, markerText, location));

Application crashes when using Google Maps v2 on most devices

半城伤御伤魂 提交于 2019-12-10 17:35:33
问题 Im trying to code some application that uses Google Maps API. The map is shown in the main activity. On some phones, including the emulator, the application crashes immediately after starting. The only phone it works with is my Galaxy S1, which runs CM10.1 (4.2.2). It crashes on my HTC DESIRE HD (4.2.2 as well) MainActivity.java: import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle

Custom MapView throwing NoSuchMethodException, but it's there!

本秂侑毒 提交于 2019-12-10 16:28:15
问题 I'm trying to implement a custom MapView. Inside my MapActivity (named mainmap) I have an inner class which extends MapView: private class Lmapview extends MapView{ public Lmapview(Context context, AttributeSet attrs) { super(context, attrs); gestures = new GestureDetector(mainmap.this, new GestureListener(this)); } public boolean OnTouchEvent(MotionEvent event){ return gestures.onTouchEvent(event); } } I have my main.xml formatted to find the inner class like so: <?xml version="1.0" encoding

Android MapView v2 Black screen

本小妞迷上赌 提交于 2019-12-10 15:57:59
问题 I've been trying to implement v2 of android's MapView. I got it working just fine with the exception to this bug. This is what it looks like when I load the app from scratch... As you can see, no problems there. Now, when I press the "Home" button and try to access the app from the "recent apps" window i get this: and it stays that way until i dismiss the app and re-load it from scratch. Here is some of my code. Layout.xml <LinearLayout android:id="@+id/maps_container" android:layout_width=