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

  • Home
  • SEARCH
  • 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 8418891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:27:13+00:00 2026-06-10T02:27:13+00:00

I am using PreferenceActivity for storing language. This is my XML. <item>US</item> <item>UK</item> <item>CANADA</item>

  • 0

I am using PreferenceActivity for storing language. This is my XML.

<item>US</item>
        <item>UK</item>
        <item>CANADA</item>
        <item>CANADA_FRENCH</item>
        <item>CHINESE</item>
        <item>FRENCH</item>
        <item>GERMAN</item>
        <item>ITALIAN</item>
        <item>JAPANESE</item>

<string-array name="listOfLanguagesValues">
        <item>US</item>
        <item>UK</item>
        <item>CANADA</item>
        <item>CANADA_FRENCH</item>
        <item>CHINESE</item>
        <item>FRENCH</item>
        <item>GERMAN</item>
        <item>ITALIAN</item>
        <item>JAPANESE</item>

Then i read save dlanguage with

String selectedLanguage = sharedPreferences.getString("listOfLanguages", "NULL");        

but i don’t know how to use now LOCAL.SELECTED LANGUAGE. This languages are all from LOCAL. options

Can i somehow cast it to local?

  • 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-10T02:27:15+00:00Added an answer on June 10, 2026 at 2:27 am

    I hopr I get the question!!

    You need a second array. For example:

        <string-array name="languageSettings">
            <item name="0">UK</item>
            <item name="1">German</item>
            <item name="2">Italy</item>
        </string-array>
        <string-array name="languageSettingsValues">
            <item name="0">UK</item>
            <item name="1">DE</item>
            <item name="2">IT</item>
        </string-array>
    

    You can connect it to your ListPreference like this:

        <ListPreference
        android:defaultValue="0"
        android:entries="@array/languageSettings"
        android:entryValues="@array/languageSettingsValues"
        android:key="languageSetting"
        android:summary="@string/preferences_alternativesettings_text"
        android:title="@string/preferences_alternativesettings_titel" />
    

    This line should work

    String selectedLanguage = sharedPreferences.getString("listOfLanguages", "NULL");  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ListPreference within PreferenceActivity. With this widget, is it possible to apply a
For my PreferenceActivity, I am using the typical preferences.xml file. The entryValues of a
Using PreferenceActivity, Android automatically saves simple preferences such as checkboxes being checked etc. I
I am using a PreferenceActivity to show some settings for my application. I am
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using CI for the first time and i'm smashing my head with this seemingly
I am using a PreferenceActivity to let the user set some values. I am
I'm using common code in my Activity like this: abstract class CommonCode extends Activity
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
i'm using PreferenceActivity in my app for settings and when tried to set a

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.