サーバーから画像をビットマップとしてダウンロードし、描画可能なものに変換します。この描画可能なものを通知アイコンとして使用したいと考えています。しかし、私はそれを行うことができません。ここに私のコードがあります:
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setSmallIcon(bitmap)
.setWhen(when)
.build();
しかし、アイコンは Resources int 値なので、使用するとエラーが発生します。どんな助けでも
編集:
今、私は自分のコードを更新し、今私はそのようにやっています:
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setSmallIcon(icon)
.setLargeIcon(bitmap)
.setWhen(when)
.build();
ただし、左側に大きなアイコン、右側に小さなアイコンが表示されます。私はこれを望んでいないので、setSmallIcon行を削除してコードを実行しますが、通知が表示されません