Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11844] Android: preferences.xml: load defaults on start

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterMartin Guillon
AssigneeAshraf Abu
Created2012-10-21T15:55:07.000+0000
Updated2016-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

FileDateSize
preferences.xml2012-10-21T15:55:07.000+0000477

Comments

  1. Martin Guillon 2012-10-21

    pull request https://github.com/appcelerator/titanium_mobile/pull/3311

JSON Source