Problem Description
If a AlertDialog is hidden by .hide(), the Dialog can not be shown again using .show().
Happens on Blackberry Simulator an on device.
Steps to reproduce
1. Create a new mobile project with bb support
2. Add this to app.js:
var win = Ti.UI.createWindow({backgroundColor:'white',});
win.open();
var a = Ti.UI.createAlertDialog(
{ message: 'Message a', buttonNames: ['OK'] }
);
a.show();
a.hide();
a.show();
3. Run this in the emulator.
Expected results
The app showing the alert dialog.
Actual results
The app doesn't show anything after using the .hide function.
Extra info
If you try to show other dialogs, and use hide in the first one, that hide will block all the others dialogs, like in this code:
var win = Ti.UI.createWindow({backgroundColor:'white',});
win.open();
var other = Ti.UI.createAlertDialog(
{ message: 'Message other', buttonNames: ['OK'] }
);
var a = Ti.UI.createAlertDialog(
{ message: 'Message a', buttonNames: ['OK'] }
);
a.show();
a.hide();
other.show();
a.show();
even if other is never "hide", it won't show.
We ran this code and the one in the steps to reproduce in iOS and Android, and ran without issues.
To make this more worse: if i hide one Titanium.UI.AlertDialog with .hide(), other dialogs after this will not show up too! Example: var other = Ti.UI.createAlertDialog({ message: 'Message', buttonNames: ['OK'] }); var a = Ti.UI.createAlertDialog({ message: 'Message', buttonNames: [] }); a.show(); a.hide(); other.show(); 'other' will not pop up.
Note to the reporter: The priority will be set by the Leader of the project. Thanks for reporting this issue! We will look into it as soon as possible.
AlertDialogs in BlackBerry are not to be reused. They get internally deleted after hidden. If we were to keep them alive, we would run into memory issues and crashers. Do not reuse an AlertDialog. Thanks for reporting.
Reopening and creating two bugs: 1. One for docs (this should be documented) 2. This is still failing if at least one of your dialogs are in "hide" state (which should not affect the behavior of other dialog, since they are independent).
Since this one was marked as won't fix by the platform team, we added two bugs (clone of this one): - One for documenting the behavior - One to fix the effect of the hide function across other dialogs in the window.
Fixed in this PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/224
Closing ticket as BlackBerry is no longer supported by us.