[TIMOB-26645] Android: Calling finish() on root splash screen activity should exit the app
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-01-04T21:19:03.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.0.0 |
Components | Android |
Labels | activity, android, close, exit |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2018-12-12T00:17:47.000+0000 |
Updated | 2019-01-07T15:01:37.000+0000 |
Description
*Summary:*
Calling
Activity.finish()
on the root splash screen activity should automatically close all child windows/activities and exit out of the app.
It should only work this way for the root activity. Finishing/closing an activity in the middle of the stack should not automatically close the child activities.
*Note:*
This is mostly needed for Titanium apps launched via the Java startActivityForResult()
method. In this case, the Titanium developer must call the Activity.setResult()
method on the root activity and exit out to respond to the other app with the result. You typically call Activity.finish()
just after Activity.setResult()
when following Google's examples.
*Steps to reproduce:*
Build and run with the below code on Android.
Tap on the "Close" button.
Notice that the app does not exit out.
var rootActivity = Ti.Android.currentActivity;
var window = Ti.UI.createWindow();
var button = Ti.UI.createButton({ title: "Close Root Activity" });
button.addEventListener("click", function() {
rootActivity.finish();
});
window.add(button);
window.open();
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10519
FR Passed. PR Merged.
Closing ticket. Fix verified in SDK version 8.0.0.v20190107030906. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10519