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 8615339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:21:13+00:00 2026-06-12T05:21:13+00:00

I have an arrays.xml file containing quite a few string-array elements for use with

  • 0

I have an arrays.xml file containing quite a few string-array elements for use with Spinners in my app. I need to send a certain value for each selection with web service calls. The web service takes the database value represented by the description, not the description itself, so I set up the string-array like this:

<string-array name="collection_method">
    <item name="blank"></item>
    <item name="P">Prepaid</item>
    <item name="C">Collect</item>
    <item name="T">Third Party</item>
    <item name="D">Cash On Delivery</item>
</string-array>

My question is this: Is there a way to programatically get to the name value for the elements of the string-array?

  • 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-06-12T05:21:14+00:00Added an answer on June 12, 2026 at 5:21 am

    If I understand correctly using a Spinner you can bind 2 arrays, one for entries and one for values, this similar question describes this method and alternatives to it:

    Android – configure Spinner to use array

    EDIT: Looking again at the linked question its not right, but you can still use dual arrays, you just have to get the selected index of the spinner and look up the value in the other array using:-

    String value = getResources().getStringArray(R.id.value_array)[selectedIndex];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml layout file which contains a few widgets including a Spinner
I have an array I load with lots of data from an xml file.
I have a byte[] containing data for a file. Array can contain data for
Possible Duplicate: Android XML Percent Symbol hi mate i have an array in file
I have an XML file with texts in a certain language and I need
In my xml file I have arrays of ints written as follows: 1 10
I have an array of System.Xml.XmlNode with data similar to this: [0] = <Node1
I have the following XML array: [link]=> array(2) { [0]=> object(SimpleXMLElement)#311 (1) { [@attributes]=>
I have a ListView in main.xml where android:entries=@array/list1 and I'd like to update that
I have arrays like this. [11] => Array ( [transactioncurrencyid] => Array ( [!name]

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.