“android.view.WindowManager$BadTokenException: Unable to add window” on buider.show()

前端 未结 10 784
忘掉有多难
忘掉有多难 2020-11-22 10:43

From my main activity, I need to call an inner class and in a method within the class, I need to show AlertDialog. After dismissing it, when the OK

10条回答
  •  有刺的猬
    2020-11-22 11:00

    I try this it solved.

     AlertDialog.Builder builder = new AlertDialog.Builder(
                       this);
                builder.setCancelable(true);
                builder.setTitle("Opss!!");
    
                builder.setMessage("You Don't have anough coins to withdraw. ");
                builder.setMessage("Please read the Withdraw rules.");
                builder.setInverseBackgroundForced(true);
                builder.setPositiveButton("OK",
                        (dialog, which) -> dialog.dismiss());
                builder.create().show();
    

提交回复
热议问题