redth-org / AndHUD

Android Progress HUD and Dialog helpers for Xamarin.Android apps!
Apache License 2.0
179 stars 69 forks source link

[Android 9.0] ShowToast not working with AndHUD 1.4.0 #38

Closed azuken closed 5 years ago

azuken commented 5 years ago

Hi,

We have an issue with ShowToast function, which throw no error but stop async execution.

We just upgraded our project from Xamarin Forms 3.1 (3.1.0.583944) to 3.4 (latest release 3.4.0.1029999), we are also now targeting Android 9.0, and AndHUD to 1.4.0. I've done some tests, and AndHUD update is the problem. Rollback to 1.2.0 solves the problem. Rollback to 8.1 Android target or Xamarin Forms 3.1 didn't change issue.

Cheesebaron commented 5 years ago

Can you provide an example of the usage?

You are calling ShowToast in an async method? Which thread are you on at the time of the execution?

azuken commented 5 years ago

Here is my implementation :

In Droid project

public void ShowToast(string message, TimeSpan duration) { AndHUD.Shared.ShowToast(CrossCurrentActivity.Current.Activity, message, MaskType.None, duration, false); }

And my call :

private async Task Notify(string successMessage) { ShowToast(successMessage, TimeSpan.FromSeconds(2)) }

So yes I call the method in an async task, and I am in the UI Thread.

Cheesebaron commented 5 years ago

Nevermind, I found the bug. When using the non-centered version of Toast there is a NullReferenceException. Will fix that asap and release a new version. Thank you for reporting the issue.

Cheesebaron commented 5 years ago

https://www.nuget.org/packages/AndHUD/1.4.1 should be there soon. If you cannot wait you can grab the NuGet from our CI: https://ci.appveyor.com/project/Redth/andhud/builds/22109106/artifacts