[英]send app to background but not go to Home
I want to send app to back form a non-activity class 我想将应用发送回非活动类
With this code ,app send to background but all other apps send to background too 使用此代码,应用程序将发送到后台,但所有其他应用程序也将发送到后台
Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
Home.context.startActivity(i);
I want only this app send to background 我只希望此应用发送到后台
How to do this? 这个怎么做?
Thanks 谢谢
When you use some global stuff then you need to do some trick by which your application can't affect other applications. 当您使用一些全局性的东西时,您需要做一些技巧,使您的应用程序不影响其他应用程序。
A small technique for your help..Use a KEY for your app and save it inside a SharedPreference
. 一种帮助您的小技巧。为您的应用程序使用KEY并将其保存在
SharedPreference
。 Use this key to identify your application. 使用此键来标识您的应用程序。 And If the key is perfect then do your code.
如果密钥是完美的,那么请编写代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.