Here is How I close my alertDialog
lv_three.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
GetTalebeDataUser clickedObj = (GetTalebeDataUser) parent.getItemAtPosition(position);
alertDialog.setTitle(clickedObj.getAd());
alertDialog.setMessage("Ögrenci Bilgileri Güncelle?");
alertDialog.setIcon(R.drawable.ic_info);
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("Tamam", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// User pressed YES button. Write Logic Here
}
});
alertDialog.setNegativeButton("Iptal", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//alertDialog.
alertDialog.setCancelable(true); // HERE
}
});
alertDialog.show();
return true;
}
});