Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26645] Android: Calling finish() on root splash screen activity should exit the app

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2019-01-04T21:19:03.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.0.0
ComponentsAndroid
Labelsactivity, android, close, exit
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-12-12T00:17:47.000+0000
Updated2019-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();

Comments

  1. Joshua Quick 2018-12-12

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10519
  2. Lokesh Choudhary 2019-01-04

    FR Passed. PR Merged.
  3. Samir Mohammed 2019-01-07

    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

JSON Source