Specifiy package path for Androd:entries

Posted by Priyank on Stack Overflow See other posts from Stack Overflow or by Priyank
Published on 2010-05-24T07:25:23Z Indexed on 2010/05/24 7:31 UTC
Read the original article Hit count: 351

Filed under:
|
|

Hi.

I am using following code in preferences page in android to show a list of items. The list and values are located in a file at location "app/res/xml/time.xml"

 <ListPreference
           android:title="Time unit list"
           android:summary="Select the time unit"
           android:dependency="Main_Option"
           android:key="listPref"
           android:defaultValue="1"
           android:entries="?xml:time/timet"
           android:entryValues="@xml:time/timet_values" />

The code for the time.xml is as follow:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="timet">
        <item>seconds</item>
        <item>minutes</item>
        <item>hours</item>
    </string-array>

    <string-array name="timet_values">
        <item>3600</item>
        <item>60</item>
        <item>1</item>
    </string-array>
</resources>

I am not able to reference these values in my preference xml file. (The code snippet above). It gives an error. How can I specify packaged path for the List preferences entry and entry_values

Any help is appreciated. Cheers

© Stack Overflow or respective owner

Related posts about Xml

Related posts about android