Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>once try this</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout); findViewById(R.id.test).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { show(); } }); } AlertDialog alertDialogBox; private OnClickListener clickListner = new OnClickListener() { @Override public void onClick(View v) { show(); } }; private boolean conditionVal = false; public void show() { AlertDialog.Builder b = new AlertDialog.Builder(this); alertButtonValue = false; b.setNegativeButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); b.setPositiveButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); this.alertDialogBox = b.create(); this.alertDialogBox.setTitle("Helllo"); this.alertDialogBox.setMessage("message..."); alertDialogBox.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (alertButtonValue == false) { Button button = alertDialogBox .getButton(DialogInterface.BUTTON_NEGATIVE); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!conditionVal) Toast.makeText(getApplicationContext(), "Condition not satisfied", Toast.LENGTH_SHORT).show(); } }); alertButtonValue = true; } else { Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_SHORT).show(); } } }); this.alertDialogBox.show(); } private boolean alertButtonValue = false; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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