android-maps-v2

Android MapView v2 Context Issues and Memory Leak

你离开我真会死。 提交于 2019-12-04 16:07:50
I'm using MapView v2 in my application (not MapFragment ) and it's causing a memory leak. The leak occurs when I pass the Activity context to the MapView constructor. If I pass the Application Context to the MapView constructor the memory leak goes away, however the MapView starts performing badly when I scroll the ScrollView it's in. Here's a snapshot of where the leak is happening: The relevant code in MapView is: public class MapView extends android.widget.FrameLayout { private final com.google.android.gms.maps.MapView.b gD; static class b extends com.google.android.gms.dynamic.a<com.google

Remove a circle from Android Google Maps API v2 without clearing map

狂风中的少年 提交于 2019-12-04 16:03:35
问题 I am drawing a circle on my map like this: CircleOptions circle=new CircleOptions(); circle.center(centre); circle.strokeColor(0xFFFFA420); circle.strokeWidth(2f); circle.fillColor(0x11FFA420); circle.radius(radius); myMap.addCircle(circle); To remove this circle, I am calling myMap.clear() , which removes all items added to the map. The question is how to remove this circle without removing all others items on the map? 回答1: Try calling remove() on the Circle object that you get back from

Google Maps v2 Error on use of setMyLocationEnabled

筅森魡賤 提交于 2019-12-04 15:28:53
I am not sure were I went wrong, getting a nullPointerException on using googlemap.setMyLocationEnabled(true) in Google Map v2 example. MainActivity.java File: package com.example.locationgooglemapsv2; import java.io.IOException; import java.util.List; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app

Map and Moving Marker using Google Maps API

爷,独闯天下 提交于 2019-12-04 14:33:39
问题 I have to write a demo , that should work like Moving Map within Flight and need to draw same curved Polyline between two geo points / locations as you can see in below image . Even, I would not mind switching to some other SDK like Mapbox SDK (If someone of you can really help me in getting What I need actually) To draw a Polyline between two points, I am using: private void polyLine() { LatLng starting = new LatLng(##.######, ##.######); LatLng ending = new LatLng(##.######, ##.######);

Android GoogleMap or SupportMapFragment - null pointer exception

≡放荡痞女 提交于 2019-12-04 14:01:28
问题 In my app i showing google map version2 in a fragment. but i get Null pointer exception at mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); This is my full code: public class SearchResultMap extends Fragment{ private GoogleMap mMap; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fragmentView

Google Map Android API v2 : GoogleMap is null

▼魔方 西西 提交于 2019-12-04 13:53:34
问题 I'm trying to explore using the MapView class for GoogleMap display, with no luck, as most codes examples are using MapFragment which I do not want. I am using Google Maps Android API v2. At first, just for testing with here from Google's example, I managed to get the typical normal map to display. public class POnlineMapView extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.online_map_activity); } }

How to get the location of centered place pin on Map like uber android app

走远了吗. 提交于 2019-12-04 12:27:39
Someone please explain me how to get the location of centered place pin on Google Map Like in this Uber App. User can move the map but pin is always centered align and We can get the location as we keep moving the map. You can use CurrentCenterPositionMap First import the lib: compile 'br.com.simplepass:mapfragmentwrapper:0.8.0' Then, all you have to do is to put the MapFragmentWrapper xml tag as a container of your map fragment. Like this: <br.com.simplepass.mapfragmentwrapper.MapFragmentWrapper android:id="@+id/map_wrapper" android:layout_width="match_parent" android:layout_height="match

MapView (android maps api v2) inside fragment layout doesnt show

岁酱吖の 提交于 2019-12-04 11:09:17
问题 I am using viewpager to swipe between 2 action bar tabs (used eclipse wizard for this kind of navigation). I am using android maps v2 api. I want to have mapview, button and textview inside one of my tabs (i guess having mapfragment is not possible). I inflate layout for my fragment from xml like this: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.first_tab_fragment,

ClusterManager repaint markers of Google maps v2 utils

随声附和 提交于 2019-12-04 08:34:08
问题 Hi Im making a server request and when I received the request from server, I'm executing on Ui Thread a ClusterManager.addItem() but this items are not painting in the map, only when I make a zoom update (+,-) are showing. Also, I tried to debug the renderer, but onBeforeClusterRendered / onBeforeClusterItemRendered are not called until I update the zoom in map. Any ideas how to refresh map/clusterManager/markers? MarkerManager markerManager = new MarkerManager(map); clusterManager = new

Can't receive LocationClient's location updates after screen gone off

本秂侑毒 提交于 2019-12-04 08:05:34
I'm trying to write a simple Android Service that runs in background and receives location updates from LocationClient (Google Map API Android V2). The problem is that when the screen go off, my Service doesn't receives anymore location updates. I tried to check if the service was active, even with screen off, and it does (I have a TimerTask scheduling a log). When screen is on I can receive location updates, but when screen goes off I see only TimerTask's logs and I don't receive any location update. Waking up screen turns on location updates again. How can this be solved? Here is my simple