android-mapview

mapview and cameraupdate in api v2

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 01:28:44
Why the CameraUpdateFactory class is not working in my project? The app crashes if it executes the following command: CameraUpdate pino= CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())); If i remove that line (and of course the next one), the code successfully starts and shows the map. I need the mapView and i need to use the new api v2. I declare the mapView in layout in this way: <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/mappa"

Let's solve the “Failed to find style 'mapViewstyle' in current theme” error

≡放荡痞女 提交于 2019-11-29 01:13:54
Sorry to post yet another one of these, but it seems we have yet to document every solution to this issue. Here's what happened: I added a mapview, everything was working peachy. I added a slidingdrawer and moved buttons into it, then changed the root node from a linear to a relative. Since then I get an error in the Graphical Layout of my main.xml class that reads Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'mapViewStyle' in current theme. Toggling

Android: ItemizedOverlay onTouchEvent and onTap overlapping

心不动则不痛 提交于 2019-11-29 00:40:25
I am trying to place a marker on a map overlay and then present a dialog when the user selects the drawable. The problem is the events seem to overlap. After I click the map and the marker is drawn, the onTap fires immediately afterwards, and because I have just drawn the marker, it is directly under the onTap event, so my dialog always fires. Does anyone have any suggestions on how to make these events mutually exclusive? Here is the code for the map activity: public class SelectGameLocation extends MapActivity implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener

How to implemennt OnZoomListener on MapView

我是研究僧i 提交于 2019-11-28 23:44:46
I would like to have onZoomListener on my MapView. The code below is what I have done. It registers if zoom buttons are tapped. Since all new phones now supports pinch to zoom, this is useless. Does anybody have idea how to do real onZoomListener? Thanks. OnZoomListener listener = new OnZoomListener() { @Override public void onVisibilityChanged(boolean arg0) { // TODO Auto-generated method stub } @Override public void onZoom(boolean arg0) { Log.d(TAG, "ZOOM CHANGED"); // TODO Auto-generated method stub } }; ZoomButtonsController zoomButton = mapView.getZoomButtonsController(); zoomButton

Android, How to remove all markers from Google Map V2?

房东的猫 提交于 2019-11-28 22:02:26
问题 I have map view in my fragment. I need to refresh map and add different markers based on condition. So, I should remove last markers from map before add new markers. Actually, some weeks ago app was working fine and suddenly it happened. My code is like this: private void displayData(final List<Venue> venueList) { // Removes all markers, overlays, and polylines from the map. googleMap.clear(); . . . } Last time it was working fine (before new Google Map API announce by Android team in I/O

MKMapView refresh after pin moves

自闭症网瘾萝莉.ら 提交于 2019-11-28 21:40:56
A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. What should I do to manually update visual position on a map? PS. I've tried to change region to current map's region. But it does change zoom. It's strange. [mapView setRegion:[mapView region] animated:YES]; I am a little shoked after hours of research. The answer is just: [mapView setCenterCoordinate:mapView.region.center animated:NO]; Do not ask me why, but it updates a mapview and it's what i was need. MKMapView observes

Android MapView overlaps DrawerLayout

怎甘沉沦 提交于 2019-11-28 21:34:30
I have simple layout structure: DrawerLayout \-- FrameLayout // @+id/fragment_container \-- ListView // @+id/drawer_list By clicking of any drawer item I'm inserting/replacing fragment via FragmentTransaction.replace() into R.id.fragment_container with corresponding Fragment instance. One of those Fragments contains MapView . And it has rendering problems on different devices, but at the same time DDMS shows me right screenshot. EDITED Issue appears on such devices: Huawei U9508 , Android 4.0.4 (API 15) HTC Desire A9191 , Android 2.3.5 (API 10) There is no issue on such devices: Samsung Galaxy

Don't snap to marker after click in android map v2

旧街凉风 提交于 2019-11-28 21:13:42
Currently Android Map v2 snaps to marker location after click. I want to disable this behavior but see no options to do it. Does anybody know how to fix that? Based on what I read from the Markers - Google Maps Android API ( https://developers.google.com/maps/documentation/android/marker#marker_click_events ) Marker click events You can use an OnMarkerClickListener to listen for click events on the marker. To set this listener on the map, call GoogleMap.setOnMarkerClickListener(OnMarkerClickListener). When a user clicks on a marker, onMarkerClick(Marker) will be called and the marker will be

Always show zoom controls on a MapView

我的未来我决定 提交于 2019-11-28 21:03:52
问题 Is there a way to always show the zoom controls on a MapView? I have added the zoom controls using map=(MapView)findViewById(R.id.map); map.setBuiltInZoomControls(true); but the zoom controls fade in and out. I want them to always be visible. 回答1: Solved this by putting my own ZoomControls in my layout xml: <ZoomControls android:id="@+id/zoomcontrols" android:layout_width="wrap_content" android:layout_height="wrap_content" /> and then setting up onClickListeners for then to handle the zoom:

Draw A Circle On Android MapView

試著忘記壹切 提交于 2019-11-28 19:33:10
Got it fixed here is my solution: Edit: updated to reflect robguinness answer. import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.Projection; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; public class CircleOverlay extends Overlay { Context context; double mLat; double mLon; float mRadius; public CircleOverlay(Context _context, double _lat, double _lon, float radius ) { context =