mapfragment

NullPointerException : Attempt to invoke virtual method 'void com.google.android.gms.maps.MapFragment.getMapAsync

允我心安 提交于 2021-02-10 15:54:55
问题 I'm using com.google.android.gms:play-services-maps:11.0.2 version of Google Map Service. When trying to call the below, I get the following error: java.lang.NullPointerException: Attempt to invoke virtual method void com.google.android.gms.maps.MapFragment.getMapAsync(com.google.android.gms.maps.OnMapReadyCallback)' on a null object reference Below is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

Android : MapView in a CollapsingToolbarLayout

时光毁灭记忆、已成空白 提交于 2020-06-14 06:46:34
问题 I'm currently trying to put a Map View (or a fragment containing the map)inside a CollapsingToolbarLayout . I would want to have the parallax effect on it when the RecyclerView scrolls. Unfortunately, it isn't showing up at all! Not even the grey grid! The collapsing animation is working though. I've search everywhere, but all I was able to find is about ImageView and no other component. So here are my questions : Is it even possible to put anything else than an ImageView in a

GoogleMap (Android) projection visible region not updated after orientation change?

戏子无情 提交于 2020-05-30 03:09:10
问题 When my SupportMapFragment onCreateView() method is called, I read the map's getProjection().getVisibleRegion().latLngBounds.northeast.x and getProjection().getVisibleRegion().latLngBounds.southwest.y The first time I launch the app (in portrait mode), I get x=720 and y=1230 . However, after changing the orientation to landscape I'm seeing the same values again. Going back to portrait mode yields x=1280 and y=670 (which is what I'd expect from landscape), and going back to landscape gives the

Start Activity with MapFragment from another Activity

99封情书 提交于 2020-01-06 12:53:08
问题 I developed an application and I need to start a new activity from my menu with a simple button. I made several tests and noticed that if I set the intent-filter of Activity that contains the MapFragment as follows: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> this works fine without any crashes. If instead modify the intent-filter in such a way as not to start the Activity soon as you open the app and in particular the edit

MapFragment: bad performance after using the back button

我怕爱的太早我们不能终老 提交于 2019-12-30 00:07:06
问题 I have a performance issue when using MapFragment together with the action bar menu. The bug emerges when three conditions are met Have a MapFragment instantiated. Trigger a fragment transaction from the options menu, replacing the map fragment with another fragment. Hit the back button and return to the map fragment. The performance is now noticeably degraded. Panning and zooming is very jerky. Opening the options menu again and dismissing it again fixes the issue. The behavior does not

Google Maps API v2 Custom MapFragment + SimpleFragment

我的未来我决定 提交于 2019-12-24 08:22:13
问题 I need to create a simple application which contain 1. Custom MapFragment which can display current location (LocationListener?), two markers, etc. 2. Simple empty Fragments. The application must not use support v4 (sdk 11+) / FragmentActivity. Empty fragment. XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" >

MapFragment and Camera seem to interfere with each other in the same Activity

China☆狼群 提交于 2019-12-23 20:10:44
问题 I'm trying to use a MapFragment from the Google Maps Android API v2 in conjunction with a Camera preview. I need to be able to switch between the camera preview and the MapFragment, but I can’t make it work. For the Camera preview, I’ve copied the CameraPreview class from the example guide. When I want to see the Camera preview, I add an instance of the CameraPreview class to my activity using CameraPreview mPreview = new CameraPreview(this); addContentView(mPreview, new LayoutParams

Maps Android V2: java.lang.noclassdeffounderror: com.google.android.gms.R$styleable

流过昼夜 提交于 2019-12-23 03:21:59
问题 As many I get the following error: java.lang.noclassdeffounderror: com.google.android.gms.R$styleable when trying to implement Maps for Android V2. Somehow I must be missing what I exactly am doing wrong, since it's not working. What I tried first is to copy the google-play-services.lib into the lib folder, but I saw somewhere I shouldn't do this. Then I tried to import addon-google_apis-google-8 as a project, but the project gives the error The import com.google cannot be resolved. I'm

SupportMapFragment vs MapFragment performance-wise

橙三吉。 提交于 2019-12-22 08:06:28
问题 Are there any differences between SupportMapFragment and MapFragment? In the reference it says that you should only use MapFragment when you target Android API level 12 and higher, but are there any other differences? Is one of them faster? 回答1: Are there any differences between SupportMapFragment and MapFragment? One begins with the word "Support". :-) Beyond that, MapFragment inherits from android.app.Fragment , which SupportMapFragment inherits from android.support.v4.app.Fragment . In the

Add custom button to MapFragment with the same style of Maps app

雨燕双飞 提交于 2019-12-18 18:31:31
问题 I need add some custom buttons on my MapFragment. I use this code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <!--suppress AndroidDomInspection --> <fragment android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_alignParentBottom="true"