Why does my alert dialog not appear? <p>Can sombody please help me? When I click on the button nothing happens. I'm very new to android-programming so please answer as i can understand.</p> <p>(Don't wonder about my variables)</p> <p>Thank you</p> <pre><code>@Override public void onClick(View v) { Button preis = (Button) findViewById(R.id.essenpreis); preis.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // Creating alert Dialog with one Button AlertDialog.Builder alertDialog = new AlertDialog.Builder(options.this); // Setting Dialog Title alertDialog.setTitle("Essenspreis"); // Setting Dialog Message alertDialog.setMessage("Neuen Preis eintragen:"); // Setting Icon to Dialog // alertDialog.setIcon(R.drawable.tick); // Setting OK Button alertDialog .setPositiveButton("YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { // Write your code here to execute after dialog closed Toast.makeText(getApplicationContext(),"Preis geändert!", Toast.LENGTH_SHORT).show(); } }); // Showing Alert Message alertDialog.show(); } }); } } </code></pre>