Note that there are some explanatory texts on larger screens.

plurals
  1. POAlert Dialogue box in android
    primarykey
    data
    text
    <p>In my code i want to close alert dialog immediately and start activities, when i select options mentioned in if- elseIf statements. I do not want ok and cancel buttons . My code work fine (statements inside if statements work but alert dialogue still there ). Thanks for help</p> <pre><code>final AlertDialog.Builder builder = new AlertDialog.Builder(arg0.getContext()); builder.setTitle("Favourities Management"); // TODO Auto-generated method stub int selected = 0; builder.setSingleChoiceItems(values, selected, new DialogInterface.OnClickListener() { @ Override public void onClick(DialogInterface dialog, int which) { if (values[which] == "Select Benificiary") { Intent registerUser = new Intent(FinalUtilityBillPayment.this, ListViewBeneficiaryBillPayment.class); FinalUtilityBillPayment.this.startActivity(registerUser); startActivityForResult(registerUser, 1); } else if (values[which] == "Add Benificiary") { try { mydb = openOrCreateDatabase(DBNAME, Context.MODE_PRIVATE, null); mydb.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE + " (ID INTEGER PRIMARY KEY, ReferenceNo TEXT, Mobile Text);"); mydb.close(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Error in creating table", Toast.LENGTH_LONG).show(); } try { mydb = openOrCreateDatabase(DBNAME, Context.MODE_PRIVATE, null); mydb.execSQL("INSERT INTO " + TABLE + "(ReferenceNo, Mobile) VALUES('" + ref.getText().toString() + "','" + mob.getText().toString() + "')"); mydb.close(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Error in inserting into table", Toast.LENGTH_LONG).show(); } } else if (values[which] == "Delete Benificiary") { Intent registerUser = new Intent(FinalUtilityBillPayment.this, ListViewDeleteBeneficiaryBillPayment.class); //startActivityForResult(registerUser, 1); FinalUtilityBillPayment.this.startActivity(registerUser); } } }); AlertDialog alert = builder.create(); alert.show(); } }); </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.
 

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