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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:55:31+00:00 2026-05-23T08:55:31+00:00

I am trying to fill up my ListPreference from within my Activity rather than

  • 0

I am trying to fill up my ListPreference from within my Activity rather than have the array stored in xml. However I am finding this problematic. I may be setting up my preferences wrong. I have access to my ListPreference however filling the content dynamically I can’t seem to get. I have looked at this post. Is it possible to load ListPreference items from an adapter? but I can’t seem to figure it out from this.

I am trying to occupy the ListPreference with Strings from a List of objects.

This is what I have so far:

    protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    SharedPreferences settings = getSharedPreferences(LUAS_TIMES_PREF, 0);

    ListPreference lp = (ListPreference)findPreference("station_pref");

}

Not much but how can I fill this list preference with my own list?

Thanks in advance.

  • 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-23T08:55:31+00:00Added an answer on May 23, 2026 at 8:55 am

    It should be as simple as:

    lp.setEntries(new String [] {"A Man", "A Plan"}); // set displayed text
    lp.setEntryValues(new String [] {"a_man", "a_plan"}); // set associated values 
    

    Extrapolate as required 🙂

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

Sidebar

Related Questions

I'm trying to fill an array of 20 ints with numbers from 1-20 in
I have some classes and I'm trying to fill the objects of this class.
I have a problem where I'm trying to fill an array with 30 random
I am kinda new to this, but I am trying to fill an array
I am trying to fill a form in a php application from a C#
I have been trying to do a fill using the open source Srecord Program.
I'm trying to fill an array with words inputted by user. Each word must
I'm trying to fill an array with consecutive integers using Excel and VBA to
I am trying to fill a RealVector (from Apache Commons Math) with values. I
I'm trying to fill an array in php with variables, but it's not working

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.