Asked 4 years ago
18 Nov 2020
Views 794

posted

How to show Toast in Android?

dont know how to use toast , can anyone help me on this ?
jassy

jassy
answered Nov 30 '-1 00:00

using java

Context context = getApplicationContext();
CharSequence text = "This is test !";
int duration = Toast.LENGTH_SHORT;

Toast toast = Toast.makeText(context, text, duration);
toast.show();

yogi

yogi
answered Nov 30 '-1 00:00

in KOTLIN

val text = "i am testing !"
val duration = Toast.LENGTH_SHORT

val toast = Toast.makeText(applicationContext, text, duration)
toast.show()
Post Answer