0

As a beginner in android, I used a ListPreference in a PreferenceScreen. But due to unsolvable issues with PreferenceScreen I decided to use an activity (with LinearLayout instead of this preference-screen.

But how can I implement something like a ListPreference in a LinearLayout? Some 'thing' which I can use to pick an element from the provided list? I tried to just put the whole ListPreference into the LinearLayout, which resulted in a runtime-error which I am surely not able to understand:

Didn't find class "android.view.ListPreference" on path: DexPathList[[zip file "/data/app/com.impyiablue.stoxx-2/base.apk"],nativeLibraryDirectories=[/vendor/l‌​ib, /system/lib]]

Here is the relevant part of my LinearLayout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar android:id="@+id/toolbar_setting"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"/>

    <ListPreference
        android:title="@string/UpdateInterval"
        android:summary="@string/UpdateIntervalText"
        android:key="updateInterval"
        android:defaultValue="24"
        android:entries="@array/listArray"
        android:entryValues="@array/listValues" />

    <NumberPicker
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/numberPicker"
        android:layout_gravity="center_horizontal" />

    ....

I searched for something like 'Picker' and 'ListPicker', but that does not seem to exist in the android-realm. So how to do it correctly?

Alex
  • 41,580
  • 88
  • 260
  • 469
  • 2
    What were your 'unsolvable issues' with the preference screen? – AdamMc331 Mar 04 '16 at 20:00
  • http://stackoverflow.com/questions/35730944/how-to-have-actionbar-in-preferenceactivity – Alex Mar 04 '16 at 20:02
  • i think you need to use LinearLayout with vertical orientation, and populate your drop-downs and other views manually – Yazan Mar 04 '16 at 20:05
  • a lot of resources are out there, just google it, "how to populate spinner" , "populate spinner from array in strings.xml" ... etc you will find everything and it's pretty easy. if you need specific issue feel free to ask a question about it and i will try my best :) – Yazan Mar 07 '16 at 08:21
  • 2
    Thanks for letting me know that a keyword is 'spinner'. NOW I can google. Without knowing to search for the term 'spinner', it is quite hard to find something... – Alex Mar 07 '16 at 13:32

0 Answers0