I'm using a list view and the following code to show an alert dialog:
exerciseListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
new AlertDialog.Builder(absActivity.this).setView(R.layout.layout_dialog)
.setTitle("are you sure?").
setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}).setNegativeButton("No", null).show();
return true;
}
});
}
The alert dialog appears momentarily like this:
than immediately disappears and turns:
Apperantly the problem was in the emulator, after wiping the phone's data the problem was solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.