Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3342110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:48:01+00:00 2026-05-18T00:48:01+00:00

I have preferences where you can enable/disable what items will show up on the

  • 0

I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items.

I have preferences.xml which has the layout for my preferences file, and I would like to reference a single item from the string array to use as the title.

How can I do this?

In the Android developer reference, I see how I can reference a single string with XML, but not how I can reference a string from an array resource in XML.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:48:01+00:00Added an answer on May 18, 2026 at 12:48 am

    In short: I don’t think you can, but there seems to be a workaround:.

    If you take a look into the Android Resource here:

    http://developer.android.com/guide/topics/resources/string-resource.html

    You see than under the array section (string array, at least), the “RESOURCE REFERENCE” (as you get from an XML) does not specify a way to address the individual items. You can even try in your XML to use “@array/yourarrayhere”. I know that in design time you will get the first item. But that is of no practical use if you want to use, let’s say… the second, of course.

    HOWEVER, there is a trick you can do. See here:

    Referencing an XML string in an XML Array (Android)

    You can “cheat” (not really) the array definition by addressing independent strings INSIDE the definition of the array. For example, in your strings.xml:

    <string name="earth">Earth</string>
    <string name="moon">Moon</string>
    
    <string-array name="system">
        <item>@string/earth</item>
        <item>@string/moon</item>
    </string-array>
    

    By using this, you can use “@string/earth” and “@string/moon” normally in your “android:text” and “android:title” XML fields, and yet you won’t lose the ability to use the array definition for whatever purposes you intended in the first place.

    Seems to work here on my Eclipse. Why don’t you try and tell us if it works? 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a preferences activity where I can change the language and the theme
i have a table name preferences under this there are multiple columns but i
I have an app with location services. If I disable location services in preferences,
I have some questions about the registry. We have Preferences p = Preferences.userRoot(); If
I have a preferences panel in my application in which I have a NSColorWell
I am creating application where in i have used preferences for changing font settings.
I would like some of my preferences to have icons, like the Settings app.
I have other pages within my app preferences which are stored as separate files
I have some table: table ASK with idask table PREFERENCES with idpref , fk_idask
I have a C# winforms app with a form for user preferences. An admin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.