有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java在活动调用self时传递信息

我正在开发一个应用程序,它可以实现以下功能。您将获得一组单选按钮,当您单击一个单选按钮时,它将生成一个通知。当用户点击通知时,他会被带回应用程序。唯一的问题是,现在看起来没有按钮被按下。我该怎么修?我是不是应该做一些额外的事情

我的代码如下

private void DispatchNotification(String numValue,String nameValue,CompoundButton button){
        Intent intent=new Intent(this,MainActivity.class);

        PendingIntent pIntent=PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder builder= new NotificationCompat.Builder(this);
        builder.setAutoCancel(false);
        builder.setContentTitle("Just Title");
        builder.setContentText(nameValue+" "+numValue);
        builder.setSmallIcon(R.drawable.abc_popup_background_mtrl_mult);

        builder.setContentIntent(pIntent);
        builder.setOngoing(true);
        NotificationManager manager = (NotificationManager)this.getSystemService(NOTIFICATION_SERVICE);

        manager.notify(8,builder.build());
    }

CompoundButton是我想要返回按下状态的单选键。提前谢谢


共 (0) 个答案