protected Dialog onCreateDialog(int id) {
switch (id) {
case Dialog_alert:
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final LayoutInflater li = LayoutInflater.from(this);
builder.setTitle("Choose any option: ");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setContentView(R.layout.tkentry);
// what to do after this..???
This is a dialog which asks the user to choose one of the following.
‘items’ is the String array which has “Update” and “Delete” options.
How to set separate onClick methods for them ?
“Update” and “Delete” are not BUTTONS!
You don’t need two separate
onClickmethod. You have to useint whichto know which item is being selected.