Search code examples
javaandroiddialogtoastforeground

How can I show my own Toast in the foreground of a Dialog?


I start my own Toast by using this code:

TextView txtViewToast = (TextView)findViewById(R.id.txtViewToast); txtViewToast.setText(R.string.free_slots); Toast();

This code works fine. It shows me the Toast, but in the background. I want to show this code in the foreground, over the Dialog.

final Dialog dialogPopupGewonnen = new Dialog(Start.this, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
    dialogPopupGewonnen.setContentView(R.layout.popupgewonnen);
dialogPopupGewonnen.show();

Solution

  • You have to call the Toast in the Dialog itself, so that it goes in front of it, instead of being covered by it