ToolbarItemBadgeSample
ToolbarItemBadgeSample copied to clipboard
Crashing on back in ios and doesn't update in android
It works fine but if you are on a navigation page with zero items go forward and then go back it get crash on iOS. On android the number doesn't update when you go back . At least on my MVVM project.
@amrkamal1993 I also facing this issue. @Pujolsluis can you please give any solutions
@shashikant0423 sorry i still looking for the solution :(
no help in ios issues ?
On Android, I was also facing the same issue: "the badge value was disappearing for example while going back (or pressing the back button).
However, I've fixed the issue by applying the following workaround,
Task.Run(async () =>
{
await Task.Delay(500);
//Call the method which should update the badge value here
});
So, while debugging, I noticed all code and everything looked fine, and most likely the events were not being executed in the right order. However, adding little delay actually fixed it.
You have to insert in your App.xaml.cs this following code:
public App()
{
.......
navigationPage.Popped += NavigationPage_Popped;
........
}
private void NavigationPage_Popped(object sender, NavigationEventArgs e)
{
if (ToolbarItems.Count() > 0)
{
DependencyService.Get<IToolbarItemBadgeService>().SetBadge(e.Page, ToolbarItems.First(), $"{CartNumber}", Color.Red, Color.White);
}
}
On Android, I was also facing the same issue: "the badge value was disappearing for example while going back (or pressing the back button).
However, I've fixed the issue by applying the following workaround,
Task.Run(async () => { await Task.Delay(500); //Call the method which should update the badge value here });
So, while debugging, I noticed all code and everything looked fine, and most likely the events were not being executed in the right order. However, adding little delay actually fixed it.
It worked perfectly but there is a slight fluctuation to load the badge, anyhow thanks for the help and btw do you have any idea why this is happening and any other way to fix it?
On Android, I was also facing the same issue: "the badge value was disappearing for example while going back (or pressing the back button). However, I've fixed the issue by applying the following workaround,
Task.Run(async () => { await Task.Delay(500); //Call the method which should update the badge value here });
So, while debugging, I noticed all code and everything looked fine, and most likely the events were not being executed in the right order. However, adding little delay actually fixed it.
It worked perfectly but there is a slight fluctuation to load the badge, anyhow thanks for the help and btw do you have any idea why this is happening and any other way to fix it?
Not sure why is this happening, but most likely it's a bug in the library. Alternatively, you may also try the approach suggested by "Gasdani" above as that may also fix it. Thanks!
I don't know your code but i doing in this way:
var menuPage = new MasterPage();
NavigationPage navigationPage;
navigationPage = new NavigationPage(new PageHome());
navigationPage.Popped += NavigationPage_Popped;
var rootPage = new RootPage(); //This is my MasterDetailPage
rootPage.Master = menuPage;
rootPage.Detail = navigationPage;
Thanks a lot, will try this and let you know :)
On Sat, 5 Oct, 2019, 3:35 PM Gaspare Daniele Fioretto, < [email protected]> wrote:
I don't know you code but i doing in this way: var menuPage = new MasterPage(); NavigationPage navigationPage; navigationPage = new NavigationPage(new PageHome()); navigationPage.Popped += NavigationPage_Popped; var rootPage = new RootPage(); //This is my MasterDetailPage rootPage.Master = menuPage; rootPage.Detail = navigationPage;
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CrossGeeks/ToolbarItemBadgeSample/issues/3?email_source=notifications&email_token=ABYYG3FBU2G2MOWBVA2VCZLQNBRHZA5CNFSM4FRTHXY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEANO7TI#issuecomment-538636237, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYYG3E4QMXCOUFNVEXVI63QNBRHZANCNFSM4FRTHXYQ .