Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/216.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android中从多任务栏中删除应用程序?_Android_Android Layout_Android Intent_Task - Fatal编程技术网

如何在Android中从多任务栏中删除应用程序?

如何在Android中从多任务栏中删除应用程序?,android,android-layout,android-intent,task,Android,Android Layout,Android Intent,Task,我可以借助onBackPressed()方法删除应用程序。 我是通过以下方法来做的: public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.set

我可以借助onBackPressed()方法删除应用程序。 我是通过以下方法来做的:

public void onBackPressed() {
  // TODO Auto-generated method stub
  super.onBackPressed();
  Intent startMain = new Intent(Intent.ACTION_MAIN);
  startMain.addCategory(Intent.CATEGORY_HOME);
  startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  startActivity(startMain);
  QuestionListActivity.this.finish();
 }
但该应用程序在cell/tab的多任务栏中仍有实例。
我想把它去掉。请建议..

如果您不希望您的应用出现在最近的应用列表中(长按home按钮),请将此添加到
AndroidManifest.xml中的
活动
声明中:

android:excludeFromRecents="true"

你所说的多任务条是什么意思?多任务条是一个按钮,任何安卓系统都有3个主要按钮home、backpress和rest。一个是多任务。这个解决方案在安卓L上不再工作。有什么建议吗?