[TIMOB-11844] Android: preferences.xml: load defaults on start
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Martin Guillon |
Assignee | Ashraf Abu |
Created | 2012-10-21T15:55:07.000+0000 |
Updated | 2016-06-30T04:38:10.000+0000 |
Description
*Problem description*
When you use a preferences.xml file, you would expect its default values to be set upon project creation. So I added a loadPreferences, method, you can use that method to load default values for a preference file. Moreover, upon app start, the default preferences file (xml.preferences) is automatically loaded.
*Test case*
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
win.addEventListener('open', function() {
if (Ti.App.Properties.hasProperty('testmeprop')) {
alert('property testmeprop exists!');
} else {
alert('property testmeprop DOES NOT EXIST!');
}
});
win.open();
I attached the example preferences.xml.
Attachments
File | Date | Size |
---|---|---|
preferences.xml | 2012-10-21T15:55:07.000+0000 | 477 |
pull request https://github.com/appcelerator/titanium_mobile/pull/3311