I want to toast message to display when call is received, it(toast message) has to be there till the call ends, when call ends message has to get disappear.
Any help will be needful
I want to toast message to display when call is received, it(toast message) has to be there till the call ends, when call ends message has to get disappear.
Any help will be needful
Toast doesn't have such functionality. You can give to it custom layout and custom gravity. But nothing more.
When you call show()
on it you can't tell it when it should hide. It will be done automatically.
You should use Dialogs.
You can't use toasts directly because they can be shown only fixed time which choosed by Toast.LENGTH_LONG or Toast.LENGTH_SHORT, but I see several options here:
Pseudocode:
private Handler mHandler = new Handler();
private void showToasts() {
Toast.makeText(context, text, duration).show();
mHandler.postDelayed(new Runnable() {
public void run() {
Toast.makeText(context, text, duration).show();
}
}, 500);
}
I'm not sure if it will work, but you can try.