简体   繁体   English

杀死android程序后黑屏

[英]Blank screen after killing the android process

I am developing an android app that uses a service to continuously for the broadcast purpose. 我正在开发一个使用服务连续用于广播目的的android应用。 I want to provide an option of force stop in my app. 我想在我的应用中提供强制停止的选项。 For that purpose I am using android.os.Process.killProcess(android.os.Process.myPid()); 为此,我正在使用android.os.Process.killProcess(android.os.Process.myPid()); . which is working fine. 工作正常。
I have three java files.. 我有三个Java文件。
Home.java for start and force stop MainActivity.java to start and force stop service accordingly And a service Home.java用于启动和强制停止MainActivity.java相应地启动和强制停止服务以及服务

I have invoked killProcess on force stop Onclick in MainActivity. 我在MainActivity中强制停止Onclick时调用了killProcess

But the problem is, I am getting a blank white screen on killing. 但是问题是,我在杀人时出现了空白的白屏。 Instead I want my home screen to be displayed. 相反,我希望显示我的主屏幕 How can I do this. 我怎样才能做到这一点。 Any help would be appreciated. 任何帮助,将不胜感激。

If you want tour activity to finish and move back to home screen. 如果您要完成巡回活动并返回主屏幕。 you could use system.exit(0) . 您可以使用system.exit(0) to completely exit instead of killing. 完全退出而不是杀死

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM