I have created a bottom navigation bar for my Maui app, which was working perfectly fine. However, after I created another page, I started getting the following error on my Android device: "Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first."
I have tried running the app on my Windows machine and it works perfectly fine without any errors, so I believe this issue is specific to Android devices. I have already tried looking for solutions online, but I couldn't find anything that worked for me.
Here's the code for my bottom navigation bar:
AppShell.xaml
**
<!--This navigation works when the user starts the application-->
<ShellContent ContentTemplate="{DataTemplate View:MainPage}" />
<ShellContent ContentTemplate="{DataTemplate View:Registration}"/>
<!--When the user is logged in the bottom nav appears-->
<TabBar Route="DeriTabBar">
<Tab Title="Home" Icon="deri_food_logo.png">
<ShellContent ContentTemplate="{DataTemplate View:Dashboard}" Route="Dashboard"/>
</Tab>
<Tab Title="Login" Icon="deri_food_logo.png">
<ShellContent ContentTemplate="{DataTemplate View:Login}" Route="Login"/>
</Tab>
<Tab Title="Restaurant" Icon="deri_food_logo.png">
<ShellContent ContentTemplate="{DataTemplate View:Restaurant}" Route="Restaurant"/>
</Tab>
</TabBar>**
Registration Viewmodel
**await Shell.Current.GoToAsync($"//DeriTabBar/{nameof(Dashboard)}?email={Email}"); **
and here is code that navigates to the dashboard with the email parameter