android-mapview

Default marker for android google MAPVIEW?

删除回忆录丶 提交于 2019-12-04 04:50:38
Just wondering if there is a standard/default overlay/marker that I can use in the MAPVIEW? I have been searching on the web and all tutorials talk about extending the Overlay and put your custom image on it. Is there a easier way? I just want to have a marker, nothing fancy. Regards James If you are using Eclipse as your IDE, you can add a .png, for example, to your /drawable-hdpi, /drawable-ldpi, /drawable-mdpi directories. You can then place and obtain a list of references to your overlays somewhat like this: package com.practice.mapper; import java.util.ArrayList; import android.graphics

MapView v2 keeping Context around

家住魔仙堡 提交于 2019-12-04 02:07:55
When using the MapView from the latest google maps API, I am getting a memory leak because MapView is holding onto my activity. I used Leak Canary and have this trace D/LeakCanary﹕ * GC ROOT com.google.android.gms.location.internal.t.a D/LeakCanary﹕ * references com.google.android.gms.location.internal.s.a D/LeakCanary﹕ * references com.google.maps.api.android.lib6.d.v.c D/LeakCanary﹕ * references com.google.maps.api.android.lib6.d.aj.b D/LeakCanary﹕ * references com.google.maps.api.android.lib6.gmm6.c.p.a D/LeakCanary﹕ * references com.google.maps.api.android.lib6.gmm6.c.y.mParent D

How to determine a long touch on android?

会有一股神秘感。 提交于 2019-12-04 00:49:12
I am looking for a way for when a user long touches a mapview (lets say for 1000ms) that i can some how do a certain action. How would i go about judging how long a user long touches a mapsview(or any view). It would be similar to android google maps app, when you long touch, it brings up a balloon overlay item. Edit added mapView.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { Toast.makeText(mapView.getContext(), "Hello 123", 2000); return false; } }); the above does not work... any ideas why? Edit added This is what i am trying at the moment, but

NullPointerException in ItemizedOverlay.getIndexToDraw

可紊 提交于 2019-12-03 23:49:05
I have a relatively simple MapActivity that I'm trying to make display a list of "camps" within a given map region. I've created a custom subclass of OverlayItem called CampOverlayItem, a custom ItemizedOverlay called CampsOverlay that returns CampOverlayItems, and of course a MapActivity subclass that populates the map. I'm pulling the overlay data from a database using an AsyncTask as created in my activity. The AsyncTask is triggered from a ViewTreeObserver.OnGlobalLayoutListener attached to the MapView. In the onPostExecute method of the AsyncTask, I create a new instance of my

Android getbearing only returns 0.0. Trying to use to rotate current location icon

北慕城南 提交于 2019-12-03 23:04:59
问题 This is in part an extension to a previous question: Android programming, mapview locationoverlay: how to change the default blue location dot, with another image I have been working to get the devices location to display on the map (easy with enablemylocation) but I need to replace the default icon (easy enough, sorted that) and then rotate it to correspond to the current device bearing - acquired from GPS, as it needs to be direction of movement, not direction the phone is facing. I am

android mapview not working

蹲街弑〆低调 提交于 2019-12-03 22:48:16
This is killing me!!! I seem to have done all I need to do but it just wont work! here is what i did: -created a keystore using keytool: $ keytool -genkey -v -keystore PADReleaseKey.keystore -alias pocket_aces_release -keyalg RSA -keysize 2048 -validity 10000 -got the MD5 fingerpring from it and used: $ keytool -list -alias pocket_aces_release PADReleaseKey.keystore -used it to get the mapAPI key and embedded it inside my application: <com.google.android.maps.MapView android:layout_weight="1" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent"

MapView in a Dialog

心已入冬 提交于 2019-12-03 21:42:43
I have a DialogFragment shown as a dialog using dialogFragment.show(this); The content view of this fragment is a ScrollView with a MapView at the bottom. onInterceptTouchEvent is taken care for the ScrollView because of the presence of a MapView . And it works fine when used as a normal fragment. But as a dialog, this is what happens while scrolling. The MapView goes out of the Dialog . EDIT: This didn't work: <RelativeLayout android:layout_width="match_parent" android:layout_height="160dp" android:layout_below="@id/view_text" > <com.google.android.gms.maps.MapView android:id="@+id/view_map"

Issue while using 2 map fragments in One application

夙愿已清 提交于 2019-12-03 20:09:25
I am trying to use two different Map Fragment in two different Fragment Activities. And as per the SupportMapFragment design, I am keeping the map key in the META TAG of the appilcation properties in Manifest file. However my Map view is not clearing, it is showing same map with old points in the second Fragment eventhough I am calling "getMap().clear()". Please suggest This is working fine untill and unless I dont use new MapFragment in a separate Activity, If I use new Mapfragment, it is taking the same map view, so the map view is not clearing. Code : MAP FRAGMENT public class

Google Maps Android API v2 - MarkerOptions draggable and visible methods

假如想象 提交于 2019-12-03 15:55:50
I'm playing with the new Google Maps Android API (v2) released earlier this month and I was delighted to see a MarkerOptions.draggable(boolean draggable) method which I thought would create a draggable marker when passing in a draggable value of true . However, on trying it (i.e. adding a marker as such to the map), it doesn't seem to do anything. The MarkerOptions.visible(boolean visible) method too, which I thought would hide the marker from view when passing in a visible value of false . Anyone been able to get these methods to work? The latter issue is already in the Google Bug Tracker .

How to convert a GeoPoint to a Hardware screen point

天涯浪子 提交于 2019-12-03 14:26:10
I would like to convert a GeoPoint to a screen point in order to identify all objects which are above a touch event. So, I've tried this : Projection projection = this.mapView.getProjection(); GeoPoint gie = new GeoPoint(lat, lon); Point po = new Point(); projection.toPixels(gie, po); But, po.x and po.y are not the screen coords, but the mapview coords in pixel instead of lat,lon. From the android developer website : toPixels(GeoPoint in, android.graphics.Point out) Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that provided this Projection.