Skip to content

Commit e00d491

Browse files
committed
get fragmentmanager from service instead
1 parent b1c6976 commit e00d491

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libs/Mapbox.Maui/Platforms/Android/MapboxViewHandler.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
using GeoJSON.Text;
1010
using Com.Mapbox.Maps.Plugins.Gestures;
1111
using Com.Mapbox.Maps.Plugins.Gestures.Generated;
12+
using Microsoft.Maui;
13+
using AndroidX.Fragment.App;
1214

1315
namespace MapboxMaui;
1416
public partial class MapboxViewHandler
@@ -240,7 +242,8 @@ protected override PlatformView CreatePlatformView()
240242
};
241243
mapboxFragment = new MapboxFragment();
242244

243-
var fragmentTransaction = mainActivity.SupportFragmentManager.BeginTransaction();
245+
var fragmentManager = MauiContext.Services.GetService<FragmentManager>();
246+
var fragmentTransaction = fragmentManager.BeginTransaction();
244247
fragmentTransaction.Replace(fragmentContainerView.Id, mapboxFragment, $"mapbox-maui-{fragmentContainerView.Id}");
245248
fragmentTransaction.CommitAllowingStateLoss();
246249
return fragmentContainerView;

0 commit comments

Comments
 (0)