android-maps-v2

Android Google map v2 in tab Overlapping issue, Multiple map in tab

这一生的挚爱 提交于 2019-12-01 06:34:52
I am new to android, now am working with Google maps v2, I have used tabhost to show Google map v2, In this tabhost i need to show two Google maps v2 on different tab. When i switch the tab b/w two tabs which contain map, it get overlapped. I don't know to overcome this issue. //code is here for both tab mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); mMap.setMyLocationEnabled(true); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME,

Android Google map v2 in tab Overlapping issue, Multiple map in tab

懵懂的女人 提交于 2019-12-01 05:06:13
问题 I am new to android, now am working with Google maps v2, I have used tabhost to show Google map v2, In this tabhost i need to show two Google maps v2 on different tab. When i switch the tab b/w two tabs which contain map, it get overlapped. I don't know to overcome this issue. //code is here for both tab mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); mMap.setMyLocationEnabled(true); locationManager = (LocationManager) getSystemService(Context

SupportMapFragment's getMap() returns null

只愿长相守 提交于 2019-12-01 03:15:11
I'm trying to create a SupportMapFragment dynamically and to put it in a FrameLayout container. My issue is that mMapFragment.getMap() returns null ... Anybody can help? CenterMapFragment.java public class CenterMapFragment extends Fragment { private SupportMapFragment mMapFragment; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.center_map_fragment, container, false); } @Override public void onActivityCreated (Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); if

Set Location Center of Map - GMaps v2 - Android

故事扮演 提交于 2019-12-01 03:14:50
How do I set the center of the map to a specific location using GMaps v2? This is how I did it using GMaps v1: public void setCenter( LatLng point ) { if( point.latitude*1000000 != 0 && point.longitude*1000000 != 0 ) { if( mMapController != null ) { mMapController.setCenter( point ); } /*else if( mOpenStreetMapViewControllerSource != null ) { mOpenStreetMapViewControllerSource.getController().setCenter( new org.osmdroid.util.GeoPoint( point.getLatitudeE6(), point.getLongitudeE6() ) ); mPostponedSetCenterPoint = point; }*/ } } I have looked through the API for GMaps v2 and can't find and

android maps, markers and memory leaks

浪尽此生 提交于 2019-11-30 23:31:16
I was reading the android docs http://developer.android.com/reference/com/google/android/gms/maps/MapFragment.html and I came across this sentence: Any objects obtained from the GoogleMap is associated with the view. It's important to not hold on to objects (e.g. Marker) beyond the view's life. Otherwise it will cause a memory leak as the view cannot be released. I don't fully understand that, and I'm not sure that it applies to me, but I just wanted to check: this only applies if the fragment is destroyed while the main view still exists, right? My map fragment is the only element in that

SupportMapFragment's getMap() returns null

自闭症网瘾萝莉.ら 提交于 2019-11-30 23:26:05
问题 I'm trying to create a SupportMapFragment dynamically and to put it in a FrameLayout container. My issue is that mMapFragment.getMap() returns null ... Anybody can help? CenterMapFragment.java public class CenterMapFragment extends Fragment { private SupportMapFragment mMapFragment; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.center_map_fragment, container, false); } @Override public void

Google Maps v2 lag after popping their fragment back from stack

风格不统一 提交于 2019-11-30 20:14:08
I have an Activity with a MapFragment that I add to the Activity programmatically using a FragmentTransaction : private static final String MAP_FRAGMENT_TAG = "map"; private MapFragment mapFragment = null; ... protected void onCreate(Bundle savedInstanceState) { ... mapFragment = (MapFragment) getFragmentManager().findFragmentByTag(MAP_FRAGMENT_TAG); if (mapFragment == null) { mapFragment = MapFragment.newInstance(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.fragment_wrapper, mapFragment, MAP_FRAGMENT_TAG);

Android v2 MapFragment shaking when scrolling in Scrollview

♀尐吖头ヾ 提交于 2019-11-30 19:24:14
问题 I am using the SupportMapFragment to display a static map in a ScrollView. I do not like to move / zoom the Map, just showing where the location is. When I am scrolling down/up the map shakes inside its bounds, it feels pretty laggy. My question is, how is ist possible to remove this lag, or how to use a static version of the v2 api map. This is my layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height=

SupportMapFragment or GoogleMap is null

拟墨画扇 提交于 2019-11-30 19:10:17
问题 Managed to get the codes error free, however upon launching, I somehow always get a null pointer exception at the line mMap = mapFrag.getMap(); Why is this so? Am I missing some imports or some steps? I am unsure if it's the SupportMapFragment or GoogleMap object that's causing the problem. package com.fragments; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.maps.GoogleMap; import com.google

Null pointer exception at mapFragment.getMapAsync(this) while initializing google map

白昼怎懂夜的黑 提交于 2019-11-30 19:01:47
When I use v6.5.87 of Google Play Services, I get a null pointer exception when I call getMapAsync() . I'm using a SupportMapFragment in my Fragment 's xml layout. My code: SupportMapFragment mapFragment = (SupportMapFragment) getActivity() .getSupportFragmentManager().findFragmentById(R.id.mapFragment); mapFragment.getMapAsync(this); Note: There's no problem when calling getMap() on older Google Play Services versions, but getMap() is now deprecated ( docs ). Here's the stack trace for the NPE: java.lang.NullPointerException at com.decos.fixi.fragments.FragmentLocationMap.initializeMap