ListPreference not showing by clicking on preference screen

1k views Asked by At

Nothing happens when I clicking the ListPreference on Preference screen. No entries are shown to select. (I'm testing on Android 4.4)

Preference xml:

<PreferenceCategory
        android:title="Image"
        android:key="image">
    <ListPreference
                android:title="Flash"
                android:key="flash"
                android:defaultValue="Off"
                android:entries="@array/flash"
                android:entryValues="@array/flash_values"
                android:persistent="true"/>
    </PreferenceCategory>

Array values xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="opts">
        <item>auto</item>
        <item>50</item>
        <item>100</item>
        <item>200</item>
        <item>400</item>
        <item>800</item>
    </string-array>

    <string-array name="opts_values">
        <item>auto</item>
        <item>50</item>
        <item>100</item>
        <item>200</item>
        <item>400</item>
        <item>800</item>
    </string-array>

    <string-array name="flash">
        <item>Auto</item>
        <item>On</item>
        <item>Off</item>
    </string-array>

    <string-array name="flash_values">
        <item>0</item>
        <item>1</item>
        <item>2</item>
    </string-array>
</resources>

Title is correctly shown but nothing happens on clicking the preference. No error while building. Preference List is not shown as dialog. All other types are working correctly.

Edit:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="prefscr">

    <PreferenceCategory
        android:title="Image"
        android:key="image">

        <SwitchPreference
            android:title="Video Mode"
            android:key="video"
            android:defaultValue="false"/>

        <ListPreference
            android:title="Flash"
            android:key="flash"
            android:defaultValue="Off"
            android:entries="@array/flash"
            android:entryValues="@array/flash_values"
            android:persistent="true"/>

        <SwitchPreference
            android:title="PNG"
            android:key="png"
            android:defaultValue="false"
            android:summary="Image format in PNG"
            android:enabled="false"/>

        <ListPreference
            android:title="Iso"
            android:key="iso"
            android:summary="set iso value"
            android:entries="@array/opts"
            android:entryValues="@array/opts_values"
            android:enabled="true"
            android:persistent="true"
            android:defaultValue="auto"/>

        </PreferenceCategory>

</PreferenceScreen>
1

There are 1 answers

0
JstnPwll On BEST ANSWER

Per my comment — check your preference activity to make sure you don't have any code that might override default behavior (i.e., have a touch listener on your preference that is stealing the touch event).