library / org.akop.kotx.ext.app / androidx.fragment.app.Fragment / showToast

showToast

fun Fragment.showToast(@StringRes messageResId: Int, duration: Int = TOAST_DEFAULT_DURATION): Unit

Creates and displays a new Toast with specified message and duration (which defaults to TOAST_DEFAULT_DURATION).

Does nothing if the fragment isn't attached to an activity.

Example:

showToast(R.string.update_complete)
fun Fragment.showToast(message: String?, duration: Int = TOAST_DEFAULT_DURATION): Unit

Creates and displays a new Toast with specified message and duration (which defaults to TOAST_DEFAULT_DURATION).

Does nothing if the fragment isn't attached to an activity.

Example:

showToast("Update complete")