I'm working on an android project which a custom alert dialog, it has one textview and Button.
edt.setText("Enter Comment");
AlertDialog.Builder builder = new AlertDialog.Builder(
CameraActivity.this);
builder.setTitle("Enter your Comment");
lnrt.addView(edt);
builder.setView(lnrt);
builder.setNegativeButton("SUBMIT", new OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
edText = edt.getText().toString();
new upDb(2).execute();
}
});
builder.create();
builder.show();
when i touch out side dialog its getting hide, how to avoid this? please help me.
Try
builder.setCancelable(false);
before you show the window, it does exactly what you want.
Try this one...
AlertDialog.Builder alert = new AlertDialog.Builder(this);
...
...
alert.setCancelable(false);
final AlertDialog dialog = alert.create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
This will prevent your dialog from closing when user touches area outside dialog:
dialog.setCanceledOnTouchOutside(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With