[英]How to finish the app and return to previous screen
I'm launching my app via implicit intent from other application, and after I do some work I want to exit the app and go back to where I was.我正在通过其他应用程序的隐式意图启动我的应用程序,在我完成一些工作后,我想退出应用程序并返回到我所在的位置。
My code:我的代码:
if (intent.type == MY_INTENT_TYPE) {
CoroutineScope(Dispatchers.IO).launch {
delay(5000)
progressBar.visibility = View.GONE
withContext(Dispatchers.Main) {
finish()
}
}
}
The problem I that I'm getting those errors when I call finish()
我在调用
finish()
时遇到这些错误的问题
2020-09-03 10:25:39.547 20181-20181/com.example.shareway E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2020-09-03 10:25:39.547 20181-20181/com.example.shareway E/libc:访问被拒绝找到属性“ro.vendor.df.effect.conflict”
2020-09-03 10:25:39.588 20181-20253/com.example.shareway E/Perf: Fail to get file list com.example.shareway 2020-09-03 10:25:39.590
2020-09-03 10:25:39.588 20181-20253/com.example.shareway E/Perf:无法获取文件列表 com.example.shareway 2020-09-03 10:25:39.590
20181-20253/com.example.shareway E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
20181-20253/com.example.shareway E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: 尝试获取空数组的长度
How can I exit from the app and get back to the previous screen without errors?如何退出应用程序并返回上一屏幕而不会出错?
Well..my mistake.嗯……我的错。
The code is totally fine, I just forgot to move代码完全没问题,我只是忘记移动了
progressBar.visibility = View.GONE
To the main thread到主线程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.