Questions tagged [supportmapfragment]

A Map component in an app. This fragment is the single entry-point that exposes a map to an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs. Being a fragment, this component can be added to an activity's layout file simply with the XML below.

A Map component in an app. This fragment is the single entry-point that exposes a map to an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs. Being a fragment, this component can be added to an activity's layout file simply with the XML below.

323 questions
55
votes
11 answers

Error opening SupportMapFragment for second time

When opening my SupportMapFragment (Android maps v2) for a second time (calling setContentView) I get the following error: 01-28 16:27:21.374: E/AndroidRuntime(32743): FATAL EXCEPTION: main 01-28 16:27:21.374: E/AndroidRuntime(32743):…
Klaasvaak
  • 5,634
  • 15
  • 45
  • 68
30
votes
5 answers

How to disable scrolling of AppBarLayout in CoordinatorLayout?

I have MapFragment with parallax effect inside AppBarLayout: I want to disable scrolling on AppBarLayout, because it is not possible to move across map, since touch evenys on the map are always handled as scroll events. I would like to handle…
22
votes
5 answers

How to use SupportMapFragment inside a Fragment?

I know that there has been an issue in using a nested fragment. But my application was designed to run on fragments and if i will be using activity for the map, my casting functions will have error. I would like to ask help from you on how to…
chkm8
  • 1,302
  • 1
  • 13
  • 34
22
votes
6 answers

How to show multiple markers on MapFragment in Google Map API v2?

I am using Google Map API v2 in my application to show Maps. I have followed all the steps, that is to be followed to enable Google Map in my application. public class PinLocationOnMapView extends FragmentActivity { private double mLatitude =…
20
votes
4 answers

getMapAsync() in Fragment

I having trouble implementing Google Map in Fragment. This is my the part of my fragment class: public class FragmentStoreFinderMap extends Fragment implements OnMapReadyCallback { // Google Map private GoogleMap googleMap; private int…
18
votes
4 answers

Google Maps Android API v2 SupportMapFragment memory leak

Using 2 simple activities. First Activity which only holds a button to start the 2nd Activity which holds the map: Main Activity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { …
16
votes
5 answers

Android - Unable to destroy activity after finish, caused by IllegalStateException: Can not perform this action after onSaveInstanceState

I have an activity in my app with 3 fragments. When a button is pushed on the first one, a method is called in the Activity that does some irrelevant stuff and then calls finish(). This triggers onPause() on the fragment, which does more irrelevant…
15
votes
1 answer

Differences between MapView, MapFrament and SupportMapFragment

I would know the differences because I'm developing an app and I would introduce Google Map API v2 for compiling above Android 2.3. Which should I use?
Viherbar
  • 239
  • 3
  • 13
14
votes
9 answers

Switching from fragment with map fragment leaves a black screen

I have added a full-screen map fragment to one of my three tabbed fragments. Everything works great apart from an issue I'm experiencing with switching between the tabs. Each time I switch from the fragment with the map, to one of the other…
user3746428
  • 11,047
  • 20
  • 81
  • 137
14
votes
11 answers

Android - SupportMapFragment with GoogleMaps API 2.0 giving IllegalArgumentException

I am trying to use the latest Map API 2.0 provided for Android. I am using the Support Library as I want to support Android 2.2. Following is my code: Main Activity class public class MainActivity extends FragmentActivity { public…
Nik
  • 2,913
  • 7
  • 40
  • 66
13
votes
5 answers

Android kotlin.TypeCastException: null cannot be cast to non-null type com.google.android.gms.maps.SupportMapFragment

I'm trying to code my current app in Kotlin, but I get null cannot be casted to non-null type. I've tried a lot of different stuff, but I keep getting the same problem. Not sure what to do. Any help would be appreciated! Code: class MapsActivity :…
Nate
  • 141
  • 1
  • 1
  • 4
13
votes
3 answers

Google Maps Android API v2 detect long press on map and add marker not working

I want to add a marker on map with long press. Toast in onMapClick() was display with normal tap. But long press is not working. Toast in onMapLongClick() is not displayed with long press. Also marker is not displayed on map. I'm using…
10
votes
5 answers

MapFragment causing NullPointerException at getMapAsync(this) method

I have implemented an activity which adds MapFragment at run time. The MapFragment xml has static fragment and I'm trying to get add at run time. Also I found there are some issues in Lollipop adding the map fragment at runtime. Kindly check Issue…
9
votes
5 answers

Android cannot find symbol method getMap()

I have a gps app that works fine on my phone. However, I see there were people having a null pointer exception in the production. SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); //…
Julia
  • 1,207
  • 4
  • 29
  • 47
9
votes
0 answers

Switching fragments - Google Map Fragment V2 - Activity has been destroyed Error

I have a Maps Activity (SherlockFragmentActivity) that loads in a Maps Fragment that has 2 buttons and switches between showing 2 different fragments (GoogleMapFragment & ScaleImageViewFragment) When I click the Exhibitor Map button it replaces…
1
2 3
21 22