google-maps-android-api-2

Android SupportMapFragment can't see map inside a fragment

江枫思渺然 提交于 2019-12-04 10:01:26
I'm trying to add a SupportMapFragment into a FrameLayout in my code but i get a Null Pointer Exeption. My Code: MainFragment: public class MainFragment extends FragmentActivity{ @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.activity_main); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft = getSupportFragmentManager().beginTransaction(); SecondFragment second = new SecondFragment(); ft.add(R.main_activity.frame, second); ft.addToBackStack(null); ft.commit(); } } SecondFragment: public class SecondFragment extends

Adding a button to a custom InfoWindowAdapter view that can register clicks

巧了我就是萌 提交于 2019-12-04 08:20:50
问题 I'm adding an InfoWindowAdapter with a custom layout to the Android Google Maps API v2 based map fragment. I've put a button in the view I return from getInfoWindow() and while it shows up perfectly fine, when I click on said button the window itself registers a click (blinking with a yellowish tint as usual) while the button does not. How can I make a button in the info window "clickable"? And, by extension, any view inside an info window? 回答1: Instead, listen for marker click events with

How to add custom controls to MapFragment in Google Maps Android API v2?

坚强是说给别人听的谎言 提交于 2019-12-04 07:53:46
问题 I have SupportMapFragment and I need to add custom controls into it for changing a map type. Calling getView(), I get NoSaveStateFramelayout and I don't think it is a good idea to add it directly into it or its children. What is the best way how can I can add a button over my map for changing the map type? 回答1: I have decided to override onCreateView and encapsulate the map in the code. @Override public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { View

Custom ViewPager to allow child GoogleMap control to scroll horizontally

99封情书 提交于 2019-12-04 07:03:56
I am using a GoogleMap (v2 api) inside of a Fragment inside of a ViewPager. The original issue I was having was that the ViewPager was capturing all horizontal scrolling gestures so the map could only be dragged if the user started in the vertical or diagonal directions. All horizontal dragging was captured by the ViewPager . I found that the solution is to create a derived ViewPager class and override the canScroll method. The View being dragged is passed to this method, so you can make a decision based on the type of View it is. In my case, my Fragment is a SupportMapFragment (from the com

Map marker info window without small triangle at bottom

南笙酒味 提交于 2019-12-04 05:14:56
问题 I need to show an Infowindow of a Google map marker without the small triangle at the bottom. Please check the image which I have attached. I tried by setting by changing setInfoWindowAnchor but it didn't work. Can anyone help me on this? marker_info.setInfoWindowAnchor(0,0) 回答1: In order to use the speechbubble, use the getInfoContents() override. In order to not use the speechbubble, use getInfoWindow() override. Example 1: public class MyCustomInfoWindowAdapter implements GoogleMap

Porting Android app to run on BlackBerry 10 Android runtime - Google Maps

坚强是说给别人听的谎言 提交于 2019-12-04 05:04:18
问题 I have an Android app that I want to make available to BlackBerry 10 users by porting for the BB Android Runtime. The only stumbling block is my Android app uses Google Maps API (com.google.android.maps) which the runtime doesn't support. The map screen is only a small feature of the app and I'm happy to disable it for BlackBerry users, but is this possible? I don't want to maintain two copies of the application, can I somehow code the one app so that the conversion to BAR works but the maps

Why Does Map Marker Lurch Around The Map

こ雲淡風輕ζ 提交于 2019-12-04 05:01:47
问题 I'm in Android Studio and I have a map fragment (com.google.android.gms.maps.SupportMapFragment) that has two markers. One is static and called Target. The other tracks my movements and is called Hunter. It works but the problem is that the Hunter marker lurches about. I have the update interval set at 15 milliseconds, but at walking speed it only updates about once every block. So, how do I properly add a marker to track my location and have it be reasonably accurate and update in real-time?

How to restrict Android Google autocomplete API to only get Train Stations

﹥>﹥吖頭↗ 提交于 2019-12-04 04:10:23
问题 Although there are many answers on how to restrict the API to only a specific country, couldn't find anything regarding restricting it to the train stations. Please help me out on this. Thanks. 回答1: I think this is not supported in the API at the moment. I can see a feature request to enable this feature in Places API web service: https://issuetracker.google.com/issues/35820774 I would suggest filing the same feature request for Places API for Android autocomplete. You can also see similar

Google Maps remove marker route context menu

纵然是瞬间 提交于 2019-12-04 04:03:24
I started a new project with the Google Maps template of Android Studio and just added a marker to the map. LatLng location = new LatLng(lat, lng); Marker marker = mMap.addMarker(new MarkerOptions() .position(location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker))); When I click the Marker there comes a little menu with a Google Maps icon on the bottom right corner: How can I get rid of this thing? I couldn't find anything I even don't know how to call it but I really need to get rid of it. You need to call setMapToolbarEnabled method of UiSettings Like this: @Override public

Android Google Map V2 Display Blank and show only zoom button?

纵饮孤独 提交于 2019-12-04 03:47:00
i use the google map v2 and display the multiple marker but first i want to display the map on the screen i put down my all the files here is gives only blank i will check it out all but nothing work for me main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="