Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.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 Notifications_Android Notification Bar - Fatal编程技术网

Android 当任何按钮点击时,如何阻止应用程序从通知面板启动?

Android 当任何按钮点击时,如何阻止应用程序从通知面板启动?,android,android-notifications,android-notification-bar,Android,Android Notifications,Android Notification Bar,我有一个带有两个按钮的通知面板。当我点击任一按钮时,最小化的应用程序将被打开/恢复 public void setListeners(RemoteViews view){ Intent stopNotify = new Intent(parent,HelperActivity.class); stopNotify.putExtra("DO", "stop"); PendingIntent btn1 = PendingIntent.getActivity(parent,

我有一个带有两个按钮的通知面板。当我点击任一按钮时,最小化的应用程序将被打开/恢复

  public void setListeners(RemoteViews view){
    Intent stopNotify = new Intent(parent,HelperActivity.class);
    stopNotify.putExtra("DO", "stop");
    PendingIntent btn1 = PendingIntent.getActivity(parent, 0, stopNotify, 0);
    view.setOnClickPendingIntent(R.id.notifyStopButton, btn1); 

    Intent pauseUpload = new Intent(parent,HelperActivity.class);
    pauseUpload.putExtra("DO", "pause");    
    PendingIntent btn2 = PendingIntent.getActivity(parent, 1, pauseUpload, 0);
    view.setOnClickPendingIntent(R.id.uploadPauseButton, btn2); 
   }
我希望应用程序本身保持最小化。我错过什么了吗

是否需要为PendingContent添加任何参数

提前谢谢

我希望应用程序本身保持最小化。我错过什么了吗

您正在为这些视图提供挂起内容,这些视图将在单击这些视图时启动活动

如果您不希望这样做,请不要提供将启动活动的挂起内容