[TIMOB-27256] Android: AlertDialog cannot be re-shown in a different window as of 8.0.1
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-08-21T13:28:34.000+0000 |
Affected Version/s | Release 8.0.1 |
Fix Version/s | Release 8.1.1 |
Components | Android |
Labels | alert, android, dialog, engSchedule, regression |
Reporter | ardy wongso |
Assignee | Yordan Banev |
Created | 2019-06-20T01:29:00.000+0000 |
Updated | 2019-08-21T13:28:34.000+0000 |
Description
It is working fine in 8.0.0 but not in 8.0.1
in 8.0.1 it return "Dialog activity is destroyed, unable to show dialog with message: null"
so here the case
1. i have 1 component of alert dialog with android view which used in multiple page of screen
2. when i show the alert dialog in first screen it works fine
3. when i show the same alert dialog in second screen, the alertdialog not showing, but instead it's on the first screen (when i close the second page, i saw the alert dialog in 1st page)
4. in first page when i try to show the same alertdialog, it return error "Dialog activity is destroyed, unable to show dialog with message: null"
Workaround for this issue
1. Keep re-creating new alertdialog unlike previous approach which using 1 alertdialog and used in multiple places.
Hi ! Thanks for reporting the issue. Can you please try using latest ti sdk 8.0.2.GA and check if you experience the same? You can download the sdk using this command: *appc ti sdk install 8.0.2.GA* Let us know the update.
I can reproduce this issue in Titanium 8.0.1 and above with the following code...
This is likely due to the changes we've made to [TIMOB-26978], where there were known rare crashes with
AlertDialog
andProgressIndicator
dialog when showing/hiding them from a destroyed activity window. Especially if Android's "Don't keep activities" developer option was turned on. A native Android dialog is designed to be attached to a single activity window and it can internally throw a Java exception on Google's end when showing/hiding it from a destroyed activity. We'll re-look into this. On iOS, a dialog is always shown on top of the app and is not bound to any window. I think we need to look into better replicating this behavior on Android without the above mentioned exceptions that can happen. In the meantime, I recommend that you re-create the alert dialog like you're doing now. _(Natively, I think that's our only option as well to get the same effect.)_ Thanks for bringing this issue to our attention.PR: https://github.com/appcelerator/titanium_mobile/pull/11073
FR Passed. Waiting for 8.1.0 GA before merge. Kindly back-port to 8_1_X branch.
PR (8_1_X): https://github.com/appcelerator/titanium_mobile/pull/11096
PR (8_3_X): https://github.com/appcelerator/titanium_mobile/pull/11156
Merged to master, 8_3_X and 8_1_X
*Closing ticket* fix verified in SDK version
8.2.0.v20190820104021
,8.1.1.v20190820143437
and8.3.0.v20190820103430
. Test and other information can be found at: PR (8_3_X): https://github.com/appcelerator/titanium_mobile/pull/11156 PR (8_1_X): https://github.com/appcelerator/titanium_mobile/pull/11096 Master PR: https://github.com/appcelerator/titanium_mobile/pull/11073