google-maps-android-api-2

zoom to fit all markers on map google maps v2

淺唱寂寞╮ 提交于 2019-11-28 06:56:58
I want to set the map zoom level to fit all markers on the map. I have used following method as said by many people, but it is not working for me. It is displaying some other point. if (positions.size() > 0) { final LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (Marker m : positions) { builder.include(m.getPosition()); } builder.include(positions.get(i).getPosition()); } try { googleMap.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition arg0) { googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds( builder.build(),

I get: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. when making Google maps App

人走茶凉 提交于 2019-11-28 06:44:30
问题 I followed the instructions in this link: https://developers.google.com/maps/documentation/android-api/start to make a simple android app with Google Maps API but I always get this error below when I run the app on my phone: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not

TileProvider method getTile - need to translate x and y to lat/long

自闭症网瘾萝莉.ら 提交于 2019-11-28 06:28:56
I’m porting an iOS app to Android, and using Google Maps Android API v2. The application needs to draw a heatmap overlay onto the map. So far, it looks like the best option is to use a TileOverlay and implement a custom TileProvider . In the method getTile , my method is given x, y, and zoom, and needs to return a bitmap in the form of a Tile . So far, so good. I have an array of heatmap items that I will use to draw radial gradients onto the bitmap, each with a lat/long. I am having trouble with the following two tasks: How do I determine if the tile represented by x, y, and zoom contains the

Android Google Maps fragment in the xml. I get “Unexpected namespace prefix”

不羁的心 提交于 2019-11-28 06:15:12
I'm trying to learn android, and having followed the instructions on how to use the Google Maps API V.2 I now got it working. However, the instructions on how to configure the initial state of the maps, found at developers.google.com , suggests a namespace defined in the xml-file, in this case "map". The xml-code below gives med the error "Unexpected namespace prefix "map" ". Trying to define the xmlns:map inside the fragment tag gave the same error but with "xmlns". I'm obviously missing some fundamental xml-knowledge here, can someone help me out? <RelativeLayout xmlns:android="http:/

Android Drawer Example, how to implement Google Map Fragment

走远了吗. 提交于 2019-11-28 06:01:28
问题 Actually I am trying to implement Google Map on Android Drawer example, basically I would like to show a map by selecting the first menu item. All the provided examples are using the FragmentActivity for all maps, I arranged to extend the Fragment Class (used by the drawer), creating a class suitable for Map. Unfortunately the App crash on launch: Main Activity public class HLMainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment

Google Maps API V2 - always get authentication error

蹲街弑〆低调 提交于 2019-11-28 05:23:19
问题 I found lots of questions regarding this - and I am almost ashamed to ask it myself. But no matter how hard I try, I simple do not get the Maps API running at all! Not with the demo project, com.example.mapdemo, not with my own project. I definitely have my debug.keystore SHA1 fingerprint registered, now for both my app and com.example - I also tried the browser API key where everybody says that would work, too. BUT NO. I always get: 06-16 11:21:29.860: E/Google Maps Android API(2382):

Google Maps Android API v2 - APIs related to my location deprecated. Why?

随声附和 提交于 2019-11-28 05:21:06
问题 Since the Google I/O 2013 we can read in several places of the documentation of Google Maps Android API v2 that This method / interface is deprecated. use com.google.android.gms.location.LocationClient instead. LocationClient provides improved location finding and power usage and is used by the "My Location" blue dot. See the MyLocationDemoActivity in the sample applications folder for example example code, or the Location Developer Guide. While it is great the new API appeared, I can't think

NoSuchFieldError: No static field MapAttrs of type when Using MapFragment with Play Services 6.5

倾然丶 夕夏残阳落幕 提交于 2019-11-28 04:21:41
Maybe I am missing something here, but I am not able to use the new Maps only dependency in Play Services 6.5 I get the following exception: java.lang.NoSuchFieldError: No static field MapAttrs of type [I in class Lcom/google/android/gms/R$styleable; or its superclasses (declaration of 'com.google.android.gms.R$styleable' appears in /data/app/com.kaching.merchant.dev1-1/base.apk) at com.google.android.gms.maps.GoogleMapOptions .createFromAttributes(Unknown Source) at com.google.android.gms.maps.SupportMapFragment .onInflate(Unknown Source) Manifest: <meta-data android:name="com.google.android

android java.io.IOException: Service not Available

不羁的心 提交于 2019-11-28 04:21:38
Description: I am using Google maps API V2 .I have implemented Android Reverse Geocoding at touched location. Problem: It throws exception on try { addresses = geocoder.getFromLocation(latitude, longitude,1);} catch (IOException e) { e.printStackTrace(); if(AppConstants.DEBUG)Log.v(AppConstants.DEBUG_TAG," e.printStackTrace(): "+e.getMessage()); } I am receiving latitude and longitude values correct, but i can't understand why it throws exception and i have also done Google search but it couldn't help. Can anybody please explain in details?? As stated in this Android issue 38009 - Geocoder

Showing custom InfoWindow for Android Maps Utility Library for Android

六眼飞鱼酱① 提交于 2019-11-28 03:35:02
I'm using the library Google Maps Utility for Android which allows to create clustering int he maps and I need to show a custom InfoWindow but I can't find any method to do this. In order to show the info window, I have the following class, and in the method onClusterItemRendered is where I have access to the info of the marker: class MyClusterRenderer extends DefaultClusterRenderer<MarkerItem> { public MyClusterRenderer(Context context, GoogleMap map, ClusterManager<MarkerItem> clusterManager) { super(context, map, clusterManager); } @Override protected void onBeforeClusterItemRendered