Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16544] Android: AlertDialog message property, accepted value varies by platform

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.1
Fix Version/sn/a
ComponentsAndroid
Labelsparity
ReporterBenjamin Hatfield
AssigneeUnknown
Created2014-03-03T23:57:31.000+0000
Updated2018-02-28T20:03:43.000+0000

Description

ENVIRONMENT: Studio and SDK 3.2.1.GA Android API Level 10, Genymotion Emulator Android API Level 16, Genymotion Emulator iOS 7.0.3 / Xcode 5.0.2 Chrome Version 32.0.1700.107 REPRODUCTION: Run the test code below on the Android emulator, iOS simulator and in a browser, then click on each button. EXPECTED RESULTS: Each message should be similar. ACTUAL RESULTS: Android cannot stringify the array values, Mobile Web cannot stringify the object value, but iOS can stringify both. MORE INFO: Note that the current documentation says that only a string value is accepted: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.AlertDialog-property-message Perhaps the type should be enforced rather than allow other types to be passed in. TEST CODE:
var json = { alert: "test json value" };
var arr = ["test", "array", "value"];

var win = Titanium.UI.createWindow({ 
	layout: 'vertical', navBarHidden: true
});

var button1 = Ti.UI.createButton({title:'JSON Alert Dialog'});
var button2 = Ti.UI.createButton({title:'JSON Alert'});
var button3 = Ti.UI.createButton({title:'Array Alert Dialog'});
var button4 = Ti.UI.createButton({title:'Array Alert'});

button1.addEventListener('click', function(){
	Ti.UI.createAlertDialog({message: json}).show();
});
button2.addEventListener('click', function(){
	alert({message: json});
});
button3.addEventListener('click', function(){
	Ti.UI.createAlertDialog({message: arr}).show();
});
button4.addEventListener('click', function(){
	alert(arr);
});

win.add(button1);
win.add(button2);
win.add(button3);
win.add(button4);

win.open();

Comments

No comments

JSON Source