Update/alter Android Preferences dynamicaly

by Lars Nielsen Lind » Tue, 04 May 2010 02:36:39 GMT


Sponsored Links
 Hi, I have tried to find a way to update the Android Preferences
dynamically.

Under the /res/xml directory I have placed a XML file with
CheckBoxPreference elements. During application usage some of the
preferences CheckBoxPreference elements may vary in numbers. Sometimes
there may be 10 items and at other times there may be 35.

I have tried to place the XML file in the /assets diectory (where read
and write is possible) and then tried to replace the
R.xml.<XMLFileName> in the
addPreferenceFromResource(R.xml.<XMLFileName>) with the Assets file -
but that won't work.

Is it in anyway possible to write to, during runtime programmatically,
the XML files placed in the /res directory - and if - how do we do
that?

Is it possible - programmatically - to create and delete the entries
in the preferences - thereby omitting the XML file?

Any help is appreciated.

Thanks,

Lars

--



Update/alter Android Preferences dynamicaly

by TreKing » Tue, 04 May 2010 03:58:36 GMT


 On Sat, May 1, 2010 at 4:28 PM, Lars Nielsen Lind <larsnielsenl...@gmail.com




Nope. All /res/ content is read-only.



Sure. You have a PreferenceActivity, I presume? In onCreate() you should be
able to create and all the preferences your heart desires.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--


Sponsored Links


Other Threads

1. Controling a Servo Controller? For use with robotics and sensors

I'm very interested in doing this same thing.  I'd like to connect the G1 to
an I/O controller.
Looking at this page:

2. Who will be viewing apps during Round 1 and Round 2 of the ADC2

As far as I'm aware:

First round is all users across the world.  They will give ratings, and be
selected based on said ratings.  The top 200 (20 in each category) will move
on to round 2.

During round two, the same processing will happen, but Google selected
judges will rate as well, with Google Judge scores being weighted as 60%,
and user ratings weighted at 40%.

Not sure on your other two questions :)

- Dan





--~--~---------~--~----~------------~-------~--~----~

3. Android / SQLite and Java Serialization

4. Activity stack: A B C -> press BACK -> go to A

5. Installing content provider with app

6. New adb features pushed to master

7. how to use shell command in Android app