0

I am trying to do debug screen which shows various stages of the validation process in an openCV project, these refer to detected blobs.

(Cutting to the chase) array.xml reference

<item>"@color/debug_IsCircular"</item>

or

<item>@color/debug_IsCircular</item>

Crashed the app

BACKGROUND

Debug Verbosity:

debug_TooBigTooSmall > Show All
debug_WrongRatio     > Show Most
debug_NotSquare      > Show Some
debug_NotCircular    > Show Minimal
debug_IsCircular     > Show Only Sucessful

I represent the above in colors so as to have a visual (on the display) as to what is going on

color.xml snippet Debug Screen

To declutter the debug I want to have a Verbosity setting in

preferences.xml

        <ListPreference
        android:dependency="@string/settings_displayKey"
        android:dialogTitle="@string/settings_debugVerbosityTitle"
        android:title="@string/settings_debugVerbosityTitle"
        android:summary="@string/settings_debugVerbositySummary"
        android:key="@string/settings_debugVerbosityKey"
        android:defaultValue="0"
        android:entries="@array/debugVerbosity"
        android:entryValues="@array/debugVerbosityValue"
        />

array.xml

<string-array name="debugVerbosity">
    <item>All</item>
    <item>Most</item>
    <item>Some</item>
    <item>Minimal</item>
</string-array>
<string-array name="debugVerbosityValue">
    <item>"@color/debug_IsCircular"</item>
    <item>2</item>
    <item>1</item>
    <item>0</item>
</string-array>

This line should work but FC the app

<item>"@color/debug_IsCircular"</item>

I have also tried

<item>@color/debug_IsCircular</item>

Also FC

07-06 14:57:53.920  25717-25717/com.anthonykeane.speedsignfinder E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.NullPointerException
    at android.preference.ListPreference.onDialogClosed(ListPreference.java:264)
    at android.preference.DialogPreference.onDismiss(DialogPreference.java:390)
    at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1233)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4898)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
    at dalvik.system.NativeStart.main(Native Method)

This can be hardcoded but I want to use references cos they should work. What am I missing?

4

0 回答 0