mardi 26 mai 2015

How Do I call String-array value in xml layout

I have a string-array in my string.xml file in Android res/value folder like this

my string.xml

<string-array name="books_titles_en">
    <item>Smoking Effeccts on Your Body</item>
    <item>Smoking - effects on your body</item>
    <item>How Tobacco Smoke Causes Disease</item>
    <item>patterns of use, health effects, use in smoking cessation and regulatory issues</item>
</string-array>

I need to retrieve the first element of array like this

my home.xml

 <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:paddingLeft="@dimen/frag_1_text_pad"
                android:textSize="@dimen/frag_1_text_size"
                android:paddingRight="@dimen/frg_1_text_right_pad"
                android:id="@+id/book_link0"
                android:text="@string-array/book_title_en[0]"/>

I know it seems error. How do I retrive these things on string-array in string.xml in Android

Aucun commentaire:

Enregistrer un commentaire