xxxxxxxxxx
Toast toast;
private void toast(String msg) {
if (toast != null) toast.cancel();
toast = Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT);
toast.show();
}
xxxxxxxxxx
Toast toast;
private void toast(String msg) {
if (toast != null) toast.cancel();
toast = Toast.makeText(getBaseContext(), msg, Toast.LENGTH_SHORT);
toast.show();
}
xxxxxxxxxx
String toastTextMsg = "Hello, welcome to Code2care!";
Toast toast = Toast.makeText(MainActivity.this, toastTextMsg , Toast.LENGTH_SHORT);
toast.show();
xxxxxxxxxx
Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();