Skip to content

Commit

Permalink
fix: can't exit by back button when crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTFtrue committed Apr 16, 2024
1 parent 03d2d4d commit fc9184f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/java/com/ztftrue/music/ErrorTipActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ErrorTipActivity : ComponentActivity() {
}
}
BackHandler(enabled = true) {

finish()
}
Surface(
modifier = Modifier
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/ztftrue/music/MyApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ class MyApplication : Application() {
}

private fun handleUncaughtException(e: Throwable) {

val intent = Intent(applicationContext, ErrorTipActivity::class.java)
intent.putExtra("error", e)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}
Expand Down

0 comments on commit fc9184f

Please sign in to comment.