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. android.bluetooth.a2dp.intent.action.SINK_STATE_CHANGED

HI everybody,

im currently looking for the way that my app knows when the phone has
being paired and connected to a bluetooth headset device.

I read something about this intent, but not on the Reference
documentation of http://developer.android.com

android.bluetooth.a2dp.intent.action.SINK_STATE_CHANGED

is this actually working, is it officially supported.

I mean, can we just register a broadcastreceiver to handle this
intent , check for the EXTRA_STATE string extra to see if it equals
STATE_CONNECTED and be sure that the phone is now connected with a
bluetooth headset device ???

What about this BluetoothA2dpService class?? There is no official
documentation about this, everything i found i from code snippets of
the android OS source code.

What do you guys think about this?

Greetings,

Alex.

2. Need Calendar.apk and CalendarProvider.apk

Hello All,

I need to install calendar app on emulator. But there is no default
calendar app on emulator.

I got calendar.apk from some site and successfully installed this
file. But when I open calendar application exception sceren comes ---
'The process com.android.calendar has stopped unexpectedly. Please try
again.'

I think apk was not proper. So please can anybody provide me working
Calendar.apk and CalendarProvider.apk?.

Thanks & Regards,
Piyush Jain

-- 

3. Remote Test your apps on real phones with Sony Ericsson Perfecto Mobile

4. Deactivate any calls to Log methods before publishing app

5. Experience with different Android devices and apps shown in Android Market

6. how to get user info

7. ROM Eclain 2.1 for Dream