google-maps-android-api-2

code to add markers to map using android google maps v2

爷,独闯天下 提交于 2019-11-27 14:04:25
I have lat&long values from database.how to display markers based on lat &long values using android google map api v2.In original android google maps,we display markers based on concept itemoverlay. In v2,I dont know how to display markers. dbAdapter.open(); Cursor points = dbAdapter.clustercall(Btmlft_latitude, toprgt_latitude, Btmlft_longitude, toprgt_longitude, gridsize1); int c = points.getCount(); Log.d("count of points", "" + c); if (points != null) { if (points.moveToFirst()) { do { int latitude = (int) (points.getFloat(points .getColumnIndex("LATITUDE")) * 1E6); int longitude = (int)

Open Street Maps with Android Google Maps Api v2

百般思念 提交于 2019-11-27 14:01:01
问题 Is it possible to use an open street map provider with the new Google Maps V2 Api on Android? If so can you provide an example, or documentation? I have looked quickly at the docs and found UrlTileProvider() , so it looks likely this is possible. Bonus: Is simply using the MapFragment class with OSM tiles still bound by the Google Maps TOS? 回答1: You need to extend the UrlTileProvider class so you can define the URL for OSM tiled maps and add a tile overlay like that : MyUrlTileProvider

Android Gradle How to build for Android Google APIs 4.2.2 not for Android 4.2.2

半城伤御伤魂 提交于 2019-11-27 13:55:37
Is it possible to build for Android Google APIs SDK instead of the general Android SDK with gradle? I need the Google Maps APIs in my project therefore I need to change the build target I can find only samples with the build version "17" compileSdkVersion 17 buildToolsVersion '17.0.0' Any idea how to do that? i figured it out: 1) use the Android SDK Manager and get the Google APIs for the android versions you want (start it from Android Studio, it's seperate from your old sdk manager if you used eclipse before) 2) Go to "File > Project Structure > SDKs" click the plus sign and select "Android

SupportMapFragment - cannot cast from Fragment to MapFragment

点点圈 提交于 2019-11-27 13:46:50
问题 Trying to put together a little MapFragment in an activity I'm building, but am having some trouble getting it all to work. I know that the Maps api and Play services are both installed correctly, as I did the test tutorial and everything worked fine. Following the documentation here, I'm running into the following problem: In my setUpMapIfNeeded method, I can either use getFragmentManager() or getSupportFragmentManager() . When I use the getFragmentManager() , Eclipse is cool with it but

How to put drawable as a background on InfoWindow (Google Maps API v2 for Android)?

喜欢而已 提交于 2019-11-27 13:40:24
问题 This is my custom layout for my info window: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bg_infowindow" > <LinearLayout android:id="@+id/text_box" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView style="@style/TexTitle" android:id="@+id/title" android:layout_width="wrap_content" android:layout

Google Maps API v2 Android add shape drawable as marker

Deadly 提交于 2019-11-27 13:31:46
问题 I've been trying to add a shape drawable as the marker icon for a marker I want to add on the map. shape looks like this (res/drawable/blue_circle.xml): <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <size android:width="15dp" android:height="15dp" /> <solid android:color="@color/Blue" /> </shape> and I try to add the marker like this: markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.blue_circle

Google android maps api v2 Show Marker Title Always

耗尽温柔 提交于 2019-11-27 13:27:58
问题 I have a google maps v2 in my android application and some markers on it. When user click one of these markers, a title popup comes. How can I show these titles always without user click? 回答1: Just call Marker.showInfoWindow(); . See https://developers.google.com/maps/documentation/android/marker#info_windows and https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#showInfoWindow() 回答2: Something like that: googleMap.addMarker(new

How to send google maps location info through SMS as a link

寵の児 提交于 2019-11-27 13:19:14
问题 In an application that I'm building, I am trying to send my location info(Lat,Long/ Geocoded) to my emergency contact list. I am assuming that all my recipients are using smartphones(Android/iOS) Until now, the application sends my location info as a string through SMS: "I am at: " + Some Geocoded Location However, I thought that this is not an optimal way of sending the exact location info. So, I was thinking if it was possible to generate a map through Google Maps API with a pinpoint/dot on

Map Markers with text in Google Maps Android API v2

孤街浪徒 提交于 2019-11-27 12:54:44
I have came up with this post but it is for the deprecated Google Maps API http://tech.truliablog.com/2012/02/23/custom-map-markers-for-android-google-maps/ In the new API, I could not find an easy way to do this. In fact, I could not do it at all. Basicly I want to have TextViews as a Marker on the map with 9Patch drawable as a background of the text. Trulia is still doing it with the new API v2 in their current app. You can check it here How can I do this? MaciejGórski Chris Broadfoot created a utility library that does exactly that. The library is available here: https://github.com

Google Maps V2 - Error inflating class Fragment

余生长醉 提交于 2019-11-27 12:37:22
I'm trying my hand and Android Application Development. I'm currently using Eclipse (I can't remember the version, whatever the newest is). I've crossed a bridge where I just can't seem to grasp what I'm doing wrong. I'm attempting to use the Google Maps V2 API. I've been through several documents and tried several techniques, all of which lead to the same error: Android.view.Inflate Exception: Binary XML file line #2: Error inflating class fragment I've been pounding my face into the keys for 2 days straight trying to grasp what I'm doing wrong here. Things I've done: Started with a blank