Reputation: 811
I have an alertDialog inside my ListView's onItemClick().
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FragmentActivity.this);
alertDialogBuilder
.setMessage("Do you wish to save any new/updated defects?")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id)
{
saveMe();
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
This dialog box is created only after the entire onItemClick()
is executed. This will result in the dialog box appearing after the new item in the menu is shown.
I want the dialog box to appear before the menu item is selected and shown. How can that be done?
Upvotes: 1
Views: 1471
Reputation: 1971
I think you can write this in your base adapter any component click event
Upvotes: 1