mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 08:51:52 +01:00
Use finishAffinity
instead of finishAndRemoveTask
The method used to finish (`finishAndRemoveTask`) an activity prior to going back to `MainActivity` or restarting the process led to the process prematurely exiting entirely and would result in it not being restarted or another activity not being launched. This has now been fixed by utilizing `finishAffinity` in its place which correctly only ends the activities with the same affinity as the caller.
This commit is contained in:
parent
9f5ab13858
commit
9e3b7a75b2
@ -55,7 +55,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
private var shouldFinish : Boolean = true
|
||||
|
||||
/**
|
||||
* If the activity should return to [MainActivity] or just call [finishAndRemoveTask]
|
||||
* If the activity should return to [MainActivity] or just call [finishAffinity]
|
||||
*/
|
||||
var returnToMain : Boolean = false
|
||||
|
||||
@ -183,7 +183,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
shouldFinish = false
|
||||
if (returnToMain)
|
||||
startActivity(Intent(applicationContext, MainActivity::class.java).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
|
||||
finishAndRemoveTask()
|
||||
finishAffinity()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
emulationThread!!.join(250)
|
||||
|
||||
if (emulationThread!!.isAlive) {
|
||||
finishAndRemoveTask()
|
||||
finishAffinity()
|
||||
startActivity(intent)
|
||||
Runtime.getRuntime().exit(0)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user