showToast

fun Context.showToast(msg: String, duration: Int = Toast.LENGTH_SHORT)

Displays a toast message.

Parameters

msg

The text message to show.

duration

Duration of the toast: Toast.LENGTH_SHORT or Toast.LENGTH_LONG.


fun Context.showToast(@StringRes msgRes: Int, duration: Int = Toast.LENGTH_SHORT)

Displays a toast message using a string resource ID.

Parameters

msgRes

String resource ID to show.

duration

Duration of the toast: Toast.LENGTH_SHORT or Toast.LENGTH_LONG.