google-maps-android-api-2

Android creating BitmapDescriptor exception

跟風遠走 提交于 2019-11-30 20:58:16
I'm writing an application that works alot with google map and markers on it. My task is to create and display some amount of markers on google map. Markers have custom image and text in it. Data is loading from server and i need to display new amount of data every time user moves google map camera. So i'm using android-maps-utils:0.4.3 library for creating custom Bitmap (using IconGenerator) and then create BitmapDescriptor from it. Here is part of the code: googleMap.clear() LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

Android SupportMapFragment.getMap() returns null

大憨熊 提交于 2019-11-30 20:05:23
问题 in my following code, getMap() returns null, which stop the app. If I don't do anything with the map (i.e, removing the last two lines), it shows correctly. Any idea why? Thanks. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FragmentManager fragmentManager = getSupportFragmentManager(); SupportMapFragment mapFragment = SupportMapFragment.newInstance(); mapFragmentId = mapFragment.getId(); FragmentTransaction transaction =

Getting Google Map Fragment in onCreateView using ActionBar tabs

ⅰ亾dé卋堺 提交于 2019-11-30 19:09:34
I'm trying to retrieve the Google Map fragment while using Tabs in an ActionBar. When I load the tabbed page the map loads fine, but I want to get the map object so I can center it, add markers etc. Is there a way to do this and if there is, would somebody be so kind to show me how? Here's the code for my tabbed page... The specific method I'm working with is public static class Map extends Fragment public class Page3Activity extends FragmentActivity implements ActionBar.TabListener { final Context context = this; static GoogleMap map; static MapView mMapView; DatabaseHandler db = new

Android Studio with Google Play: Google Play services is missing

做~自己de王妃 提交于 2019-11-30 19:00:44
I am using Ubuntu 14, Android Studio 0.8.6. I am using Genymotion for running the app, the response I get, is: W/GooglePlayServicesUtil﹕ Google Play services is missing. Tried the solution of Import Google Play Services library in Android Studio , also from Android Studio with Google Play Services . Installed the following packages from Android SDK Manager: Android Support Repository, Android Support Library, Google Play services, Google Repository. I'm trying to run an Android Studio default activity (Map activity). Here is the manifest file: <application android:allowBackup="true" android

Is it possible to set dimensions to a groundOverlay that is independent of the map zoom level?

邮差的信 提交于 2019-11-30 17:14:42
问题 I have a GroundOverlay on my GoogleMap and I want that its dimensions to not change when I zoom in/out on map. Exact like default map markers that always keep their dimensions. I have tried with both forms of the GroundOverlay.setDimensions() but the image is still resize on zoom. Here is my code: Bitmap btm = BitmapFactory.decodeResource(getResources(), R.drawable.map_arrow); BitmapDescriptor arrow = BitmapDescriptorFactory.fromBitmap(btm); float w = btm.getWidth(); float h = btm.getHeight()

IllegalStateException map size should not be 0 [duplicate]

自古美人都是妖i 提交于 2019-11-30 16:59:06
问题 This question already has answers here : moveCamera with CameraUpdateFactory.newLatLngBounds crashes (19 answers) Closed 6 years ago . I have a MapFragment that displays a map if the user goes away from the activity (or the device goes to sleep) with the map then comes back onResume gets called and I move the map back to a marker. however when I move the camera I get an exception 07-23 16:28:42.725: E/AndroidRuntime(19095): java.lang.RuntimeException: Unable to resume activity {ecm2.android

Android Studio with Google Play: Google Play services is missing

走远了吗. 提交于 2019-11-30 16:55:18
问题 I am using Ubuntu 14, Android Studio 0.8.6. I am using Genymotion for running the app, the response I get, is: W/GooglePlayServicesUtil﹕ Google Play services is missing. Tried the solution of Import Google Play Services library in Android Studio, also from Android Studio with Google Play Services. Installed the following packages from Android SDK Manager: Android Support Repository, Android Support Library, Google Play services, Google Repository. I'm trying to run an Android Studio default

How to make custom CoordinatorLayout.Behavior with parallax scrolling effect for google MapView?

你离开我真会死。 提交于 2019-11-30 15:44:01
I try to make a parallax scrolling effect for google MapView and RecycleView using CoordinatorLayour . so base on some tutorials found on web I made below code. The layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <com.google.android.gms.maps.MapView android:id="@+id/map_view" android

MapFragment Google Maps API v2 Out of Memory Error / Memory Leak

我的梦境 提交于 2019-11-30 15:07:51
I've read a number of similar posts over the past few days, but none that specifically answer this problem. I start getting an OOM issue after ~2 minutes of aggressive map panning and zooming with the Hybrid map. The app also seems to hold onto the memory after the crash because it takes less time to reach OOM after the first failure. I scaled down the code to just an Activity with a MapFragment and still get the same OOM. I've used DDMS and MAT to try and isolate the problem, in addition to adding android:largeHeap="true" which only delays the OOM. Screen re-orientation is not an issue

Adding multiple markers in Google Maps Api v2

帅比萌擦擦* 提交于 2019-11-30 14:42:59
I have successfully managed to show the google map api v2. I want to add markers for my positions on it. As per the documentation, I am only able to add one marker at a time or have to use a loop to add multiple. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.demo_v2); googleMap = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); googleMap.setMyLocationEnabled(true); Marker marker = googleMap.addMarker(new MarkerOptions().position