I want an custom Toast in Jetpack Compose but didn't found any helpful documentation regarding this any help will be appreciated
Custom Toasts are deprecated in favor of SnackBar.
So they mostly won't have support in Jetpack Compose.
References.
StackOverflow Post - Custom Toasts are deprecated.
Android code change deprecating Custom Toast with explaination
Deprecating custom toasts as discussed, the reasons are:
- We're blocking background custom toasts for security reasons (go/toast-abuse).
- This means custom toasts are only possible if the app is in the foreground. In the foreground the app has control over its own view hierarchy and is capable of creating any visual elements it would otherwise use custom toasts for.
- If we were to declare ongoing support for foreground toasts the developer would be in a situation where they either check for foreground status of the app before posting a custom toast or they accept that the information they want to display may not be shown at all. This is not great.
- There is also a desire to avoid custom toasts altogether since they hurt UX consistency (https://docs.google.com/presentation/d/1r5WEofZ_G3B9M65nS37uD4RqA4iV9HUmngyE6ZpBSsw/edit#slide=id.g7b69852da2_0_0).
Also added a recommendation to use Snackbars while the app is in the foreground.