jeudi 3 septembre 2015

Can't add multi choice check box to dialog

I am trying to add a single check box to my dialog but I am not able to do it. It doesn't show up. Here is my code:

private void checkAnimationSettings() {

    try {
        ContentResolver cr = activity.getContentResolver();
        float animationDurationScale =
                Settings.Global.getFloat(cr, Settings.Global.ANIMATOR_DURATION_SCALE);
        float windowsAnimationScale =
                Settings.Global.getFloat(cr, Settings.Global.WINDOW_ANIMATION_SCALE);
        float transitionAnimationScale =
                Settings.Global.getFloat(cr, Settings.Global.TRANSITION_ANIMATION_SCALE);

        if (animationDurationScale == 0.0f
                || windowsAnimationScale == 0.0f
                || transitionAnimationScale == 0.0f) {
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
            boolean newerShowAnimationsOffWarning = sp.getBoolean("newerShowAnimationsOffWarning", false);

            if (newerShowAnimationsOffWarning) return;

            CharSequence[] items = new CharSequence[]{"Bir daha gösterme"};
            Builder builder = new Builder(mainActivity);
            builder.setTitle(activity.getString(R.string.animation_settings_warning_title_text));
            builder.setMessage(activity.getString(R.string.animation_settings_warning_text));
            builder.setMultiChoiceItems(items, null, this);
            builder.setPositiveButton("Tamam", null);
            builder.create().show();
        }
    } catch (Settings.SettingNotFoundException e) {
        e.printStackTrace();
    }
}

enter image description here

What is wrong here?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire