Questions tagged [mapfragment]

The Android Fragment that represents a Map component in an Android app.

240 questions
3
votes
3 answers

Remove MapFragment

I have a MapFragment and regular Fragments in my app. The problem is when I change between the fragments, the MapFragment is in the background. I have code to find if the MapFragment is there, but I need code to remove it. Code: FragmentMapView…
3
votes
0 answers

Multiple map fragment not working with google maps api v2

In my new android project there are two tabs. First tab contains a map fragment which shows current location and nearby place lists with markers. And the second tab shows the current location only(Simply a map). But while tab switching no animation…
Hybrid Developer
  • 2,320
  • 1
  • 34
  • 55
3
votes
2 answers

findFragmentById always returns a null

I'm using an actionbar in navigation mode in the mainActivity. Different tabs has different layouts, and on one of these tabs, I embed a layout which has a MapFragment inside. With the following code, the app works well, the mapFragments works…
3
votes
1 answer

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

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…
gisking
  • 290
  • 2
  • 3
  • 8
3
votes
4 answers

Map fragment V2 in a Fragment

I am facing some issue"Null pointer Expcepttion at getmap()" in Google Map Fragments . I want to insert mapfragment in a fragment Please review the code and let know whether I am taking the right appraoch or not .. and let me know what exactly I…
3
votes
2 answers

How to instanciate a custom class that extends MapFragment (which is singleton)

I need to create a custom class that extends MapFragment. I am not sure how to instantiatemy new class, so that MapFragment will be instantiated in the correct way. MapFragment are suppose to be created by doing…
2
votes
0 answers

MapView with ViewPager2: Map Gestures not working

I have a ViewPager2 with 3 fragments. The last fragment contains a Mapview. When I try to manipulate the map, the ViewPager2 gets triggered and takes me to another fragment. This doesn't happen when I swipe up and down on the Map, I guess the…
2
votes
3 answers

Android Studio @androidx.annotation.NonNull error when onRequestPermissionResult is called inside MapFragment

Hello I am still fairly new to this, so please help me understand why I am having this error. I have tried many solutions, so I'm just going to list everything I've done since I can't seem to understand why this is happening. I created a project…
2
votes
0 answers

Google Maps API v2 default marker not aligned with manually drawn marker in LocationCallback()

I've been looking online for the past couple of weeks about this and it seems I'm not asking the right questions so posting one here. Thanks in advance for any info. Using Android v7.1 and Google Maps API v2 I want to show a user's location on a map…
2
votes
2 answers

MapFragment does not show map

I've looked through the documentation and I can't find any reason why the MapFragment only shows a grey screen with the Google logo on the lower left hand side. In my manifest, I have the appropriate meta-data on the application level (GMS version…
Joel J.
  • 425
  • 1
  • 5
  • 14
2
votes
0 answers

Map Activity ANR Issue

I have a navigation drawer activity. At onCreate, i have created a MapFragment using fragment transaction. Fragment fragment = null; String newttitl = "TEST"; fragment = new MapFragment(); FragmentManager fragmentManager…
2
votes
0 answers

Android MapFragment not calling OnMapReadyCallback

I have a simple Android application with an app drawer, which selects fragments within my activity. When I select the map fragment no map is shown because it never gets ready. Here is the code: package com.example.tanktoo.eventreporter; import…
tanktoo
  • 181
  • 12
2
votes
1 answer

Cannot find supportMapFragment.getMapSync()

I want to use supportMapFragment, which I have specified in my XML. Since supportMapFragment.getMap() is deprecated, supportMapFragment.getMapSync() is to be used. As per docs However, I cannot find the method supportMapFragment.getMapAsynSync() in…
rgv
  • 1,186
  • 1
  • 17
  • 39
2
votes
1 answer

MapFragment getMap() return null (mapBox)

I have a map offline mapBox, but the map does not load because it is null. I followed the directions of the site: https://www.mapbox.com/android-sdk/ In layout
Ortensia C.
  • 4,666
  • 11
  • 43
  • 70
2
votes
1 answer

CoordinatorLayout inside ViewPager inside CoordinatorLayout scrolling issue

I have an outer CoordinatorLayout that has, as AppBar, the Toolbar and a TabLayout bar and, as content, a ViewPager with appbar_scrolling_view_behavior: