Note that there are some explanatory texts on larger screens.

plurals
  1. POdialog box not function
    text
    copied!<p>the dialog box doesnot appear and the data still insert into DB while its empty... all code about dialog box i already use but still can function. just want a alert box appears in my current page that the edittext empty and need user to fill it.. </p> <pre><code>if (name == null || inputName.getText().toString().length() == 0) { if (price == null || inputPrice.getText().toString().length() == 0) { if (description == null || inputDesc.getText().toString().length() == 0) { // creating new product in background thread new CreateNewProduct().execute(); } else { AlertDialog.Builder alertbox = new AlertDialog.Builder(NewProductActivity.this) ; // set the message to display alertbox.setMessage("This is the alertbox!"); // add a neutral button to the alert box and assign a click listener alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() { // click listener on the alert box public void onClick(DialogInterface arg0, int arg1) { // the button was clicked Toast.makeText(getApplicationContext(), "OK button clicked", Toast.LENGTH_LONG).show(); } }); // show it alertbox.show(); } } else{ AlertDialog.Builder alertbox = new AlertDialog.Builder(NewProductActivity.this); // set the message to display alertbox.setMessage("This is the alertbox!"); // add a neutral button to the alert box and assign a click listener alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() { // click listener on the alert box public void onClick(DialogInterface arg0, int arg1) { // the button was clicked Toast.makeText(getApplicationContext(), "OK button clicked", Toast.LENGTH_LONG).show(); } }); // show it alertbox.show(); } }else{ AlertDialog.Builder alertbox = new AlertDialog.Builder(NewProductActivity.this); // set the message to display alertbox.setMessage("This is the alertbox!"); // add a neutral button to the alert box and assign a click listener alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() { // click listener on the alert box public void onClick(DialogInterface arg0, int arg1) { // the button was clicked Toast.makeText(getApplicationContext(), "OK button clicked", Toast.LENGTH_LONG).show(); } }); // show it alertbox.show(); } } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload