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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:59:32+00:00 2026-05-20T01:59:32+00:00

For my app, I have a fairly complex set of configuration options that user

  • 0

For my app, I have a fairly complex set of configuration options that user can pick from. I’m currently using a PreferenceActivity as my user interface for these options and the options are stored using shared preferences. As an example of some of the settings I have to accommodate:

  • Lists of pairs: to select a background pattern, the user can select to use from 1 to 5 different shapes (where each shape is a .png file) and assign each shape an int color. For example, the user could pick an orange square, a green triangle and a red rectangle.

  • Hierarchical data: one part of my app can be configured to use one of five modes. Each mode has a few associated unique settings e.g. one mode requires two integers to be chosen the other mode might require one boolean to be chosen.

However, my feeling is PreferenceActivity doesn’t work well with settings like the above because:

  • Shared preferences cannot store lists.
  • Shared preferences cannot store hierarchical data.
  • Boiling my preference interface down to e.g. individual preference buttons for configuring each color and using dependent preferences to disable preferences that aren’t applicable with the current mode is going to make for a messy and hard to use interface.

I could write my own Preference classes for configuring the lists, but I find these really laborious to implement compared to implementing a typical View and I’ve still got to deal with the storage issues.

My plan was:

  • Just implement a custom activity with a custom GUI. This gives me much more freedom for doing a nice interface for configuring the lists and I can do intelligent hiding of options that aren’t applicable to the current mode.
  • Store all my settings in either an XML file or by serialising a Java object. This means I can easily support hierarchical data and variable length lists, which allows room for further extensions.

Does this plan seem reasonable? I’m concerned I’m not doing things the Android way, but it seems to me that shared preferences and PreferenceActivity aren’t suited to my needs here.

  • 1 1 Answer
  • 2 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-20T01:59:32+00:00Added an answer on May 20, 2026 at 1:59 am

    Since I began in Android, I have always created my own preference activities. It seems really difficult because there is not much documentation on the internet on how to do it, but it is, in fact, really quite simple. As you said, it gives you a lot more freedom in deciding exactly how your UI looks and acts. Just in case you’re wondering how to do preferences yourself, here’s a little simple snippet:

    public class myprefs extends Activity{
    private static final String PREFS_XML = "prefs_xml";
    private static final String PREF_1 = "pref_1";
    
    String preference;
    
    private SharedPreferences preferences = null;
    public void loadPrefs(){
        preferences = this.getSharedPreferences(PREFS_XML, Activity.MODE_PRIVATE);
        preference = preferences.getString(PREF_1, "default value");
    }
    }
    

    That’s pretty much how simple it is to get your own preferences. To set them you use

    preferences.edit().putString(PREF_1, "hello!").commit();
    

    That can be put into an onClick, onItemSelected, or any other ‘event’ you want to put it into. I made ‘preferences’ a class wide instance so that I can access it anywhere in the class without having to re-instantiate it. I hope this helps you out a little bit. As a specific answer to your specific question, I would think your plan is perfectly reasonable.

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

Sidebar

Related Questions

I have a fairly complex web app that was built (by a contractor) to
I have an android app that is getting fairly large and complex now, and
I have an app that manages turns in a game, it's fairly complex and
I have a fairly simple iPhone app that downloads a set of UITableView results
I have a fairly complex app that uses celery, mongo, redis and pyramid. I
In my ASP.NET MVC app, I have a fairly complex edit page which combines
We have been working for several months on a fairly substantial iOS app using
I have a fairly complex Rails app built on top of Twitter's API, and
I have a Map activity in a fairly complex layout. As such, I can't
We have a fairly robust ASP.NET app using quite a bit of AJAX, jQuery

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.