Beena
Beena

Reputation: 2354

Dialog.setCancelable(true) seems not to be working in api level 10

    final Dialog  dlg ;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        dlg= new Dialog(getActivity(),R.style.popup_theme);
    }
    else
    {
        dlg= new Dialog(getActivity());

    }
    dlg.requestWindowFeature(Window.FEATURE_NO_TITLE);

    dlg.setContentView(R.layout.alert_prompt_list);
    dlg.setCancelable(true);

I have used above code to show my dialog. It is working fine in api level above 11. But when i run the same code in device having api 10, dialog not get dismissed on clicking outside dialog.

dlg.setCancelable(true); 

seems not to be working.

Upvotes: 2

Views: 1226

Answers (1)

David Wasser
David Wasser

Reputation: 95578

Add this to your dialog creation code:

dlg.setCanceledOnTouchOutside(true);

Upvotes: 2

Related Questions