google-maps-android-api-2

Android google maps button style

允我心安 提交于 2019-12-04 19:10:38
问题 I would like to place a button on top of my google map, which is pretty easy. However I would like it to look like the buttons google uses (zoom buttons, locate me button). Is there a way I can 'cheat' and find the styles they used for their buttons. Or has anyone else created this style before? 回答1: If you disassemble Google Play Services apk by using apktool, and look into drawable * folders, you will find the resources for these buttons among other resources. For example, this is the

MapFragment causes flickering in ViewPager

北战南征 提交于 2019-12-04 18:36:47
I use a (Support)MapFragment inside a (Support)ViewPager, filled by a FragmentPagerAdapter. The ViewPager consists of three fragments, with the map fragment on the right: |x|x|map|. When I swipe to the right from the first fragment, die whole UI visibly redraws as the MapFragment is loaded and the screen flickers. Once the map is loaded for the first time swiping between screens works fine. How can I fix this? I had the same issue with my project's (rather complex) structure: HostActivity -> HostFragment with ViewPager -> ListView with embedded MapFragment. I tried to solve this issue

Fragment with Map crashes app when back button is pressed or when orientation changes

本秂侑毒 提交于 2019-12-04 18:26:37
I have an Activity that loads 2 tabs in the ActionBar . Tab 1 loads a Fragment that will will inflate a WebView , while Tab 2 loads a Fragment with a map. Initially, I have the problem of changing tabs that causes the app to crash. I have followed the instructions here and implemented onDestroyView() . The problem now is that if I press the back button from Tab 1 ( WebView ), it exits the Activity properly. But if I do it on Tab 2 (map), the app crashes. The exact same scenario applies to when I change the orientation. I am convinced that it has something to do with the onDestroyView() , but I

Non-ASCII title for android map marker

你离开我真会死。 提交于 2019-12-04 17:18:34
I would like to be able to add a marker with a title that has only non-ASCII characters: marker = map.addMarker( new MarkerOptions() .title("אני") .position(latlng) ); Unfortunately the tile doesn't show up, only an empty info window. First I thought that there is a problem with the Hebrew characters in general, but they seem to be fine, because if there's ASCII text in the BEGINNING of the title, then it works: .title("me אני") However it doesn't when the Hebrew is in the beginning: .title("אני me") I found a hack that seems to work, but still waiting for a real solution. If I prepend an

View map in mode satellite and terrain

Deadly 提交于 2019-12-04 16:24:38
I tried to create a menu on the screen, where the menu will display the map in satellite mode and terrain. My code: public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_MyLocation: //startActivity(new Intent(this, MyLocation.class)); return(true); case MENU_LocationCar: startActivity(new Intent(this, Gps.class)); return(true); case MENU_Satellite: map.setMapType(GoogleMap.MAP_TYPE_SATELLITE); return(true); case MENU_Terrain: map.setMapType(GoogleMap.MAP_TYPE_TERRAIN); return(true); } return(super.onOptionsItemSelected(item)); } You need to refresh the

Google Maps API V2 android app on API level 8 up to 17

☆樱花仙子☆ 提交于 2019-12-04 16:02:59
I am working with the Google maps API V2 and it is going fine. i have a 2.2.2 android device wich i use to debug my app. now i just got a Galaxy Note 2, and when i try to debug on that device the app imidiatly crashed "project has stopped working". So i just made a small example to test with. and again it runs great on 2.2.2 but not on 4.1.1. this is the code i have for the small example exercise Any suggestions would be much appreciated My Layout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width=

Access the drawable resource of MyLocation blue dot in Maps

大城市里の小女人 提交于 2019-12-04 15:54:39
I would like to get the same texture as the circle that indicates your position and bearing (blue) on the map in order to add other circles (in red) with the same texture and behaviour . What I have: I have access to all the params concerning the red point : LatLng, Bearing ... I used a map.addCircle to get the result displayed below. map.addCircle(new CircleOptions() .center(position1) .fillColor(Color.RED) .strokeColor(Color.WHITE) .radius(1.2) .strokeWidth(1 / 4)); Needs: I need the circle to be independant of the tilt and independant of the zoom , ie its size adapts to the zoom level and

Animated infowindow in Google Maps v2

此生再无相见时 提交于 2019-12-04 15:53:32
I recently asked about applying an animation to a marker popup window (infowindow) and was explained why that wasn't possible: Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas) ) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call showInfoWindow() . Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events.

Maps Activity Blank after uploaded to Play Store [duplicate]

亡梦爱人 提交于 2019-12-04 15:39:47
This question already has an answer here: Published App on Play Store can't communicate with Google Maps API and Facebook API 6 answers As mentioned in the title, the Maps Activity shows blank (with Google logo underneath) after I've uploaded the application. I am aware this question has been asked many times but none of the solution is able to resolve my issue. This is what I've done so far: Generated Google Maps Release API Key (with SHA-1 signature) following the official guide here and placed it under the release/res/values/google_maps_api.xml Place the Release API Key hardcoded into the

How can I detect pogrammatically whether a Google Map was actually loaded on Android with API v2 (e.g. when network is not available)?

不羁的心 提交于 2019-12-04 15:08:11
I have the Google Map API v2 working fine on Android using a SupportMapFragment in a FragmentActivity. However, when there is no network connection (and no cached information), obviously, no map can be shown. LogCat gives me an error message confirming this ("Google Maps Android API: Failed to load map. Could not connect to Google servers"), but this is not thrown. How can I detect this case programmatically, because I would like to forward to a different Activity in this case? The docs claim that if no map could be loaded getMap() called on the SupportMapFragment would return null, but this