1

私のアプリは、リマインダーによく似た通知を表示するためのものです。これまでのところ、通知ボックスにテキストを表示できます。しかし、ユーザーがクリックしたときに別の通知に切り替える必要があります。

これが私のコードです: `else{

  Text = "go to shopping mall";
  Text2 = "meet emma";
 final PendingIntent pending = PendingIntent.getActivity(arg0.getContext(), 0, new         Intent(arg0.getContext(),MainActivity.class), 0);
new AsyncTask<Void, Void, Void>(){

    public Void doInBackground(Void... args){


        Bitmap bmp = BimapFactory.decodeResource(arg0.getContext().getResources(), R.drawable.image);

        notification = new NotificationCompat.Builder(arg0.getContext())
         .setContentTitle("I want to...")
         .setContentText(Text)
         .setContentIntent(pending)
         .setSmallIcon(R.drawable.ic_launcher)
         .setStyle(new NotificationCompat.BigPictureStyle()
             .bigPicture(bmp))
         .build();
        notificationmanager = (NotificationManager)arg0.getContext().getSystemService(Context.NOTIFICATION_SERVICE);

        notificationmanager.notify(notificationId, notification);
        notificationId++;
        return null;
    }
}.execute();

`

これはまさに私が望んでいた方法で機能します。しかし、ユーザーが通知をクリックしたときに* Text2を表示したいと思います。*

*注: * 今のところ、この通知をクリックすると、意図したアプリケーション自体に移動します。しかし、これはテキストを変更するだけで、他の場所に移動する必要はありません。

可能であれば、コードを再編集して説明することを検討してください。

4

1 に答える 1