0

I have an error while trying to run the Signal application for Android. The error is as the following :

error: incompatible types: Fragment cannot be converted to SupportMapFragment
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

And it is found in the PlacePickerActivity.java in the following line :

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

Can someone help me with this?

user1234
  • 23
  • 5

1 Answers1

0

According to Android docs: findFragmentById(int)

The findByFragmentId() function returns a Fragment, you cannot cast it to a SupportMapFragment.

You can try something like this:

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map).getMap();
MERNboy
  • 125
  • 14
  • Try using getMapAsync() like this: [https://stackoverflow.com/questions/38323120/android-cannot-resolve-method-getmap/38323166] – MERNboy Feb 07 '21 at 01:28