2016-05-17 9 views
0

必要なドロアブルをNotification.Builderに設定していますが、解決できないと言います。私は自分自身をwuno_launcherと追加しても動作しないので、動作しないic_launcherを使用しようとしました。Android設定のアイコンを通知ビルダーに設定する

private Notification getNotification(String content) { 
     Notification.Builder builder = new Notification.Builder(this); 
     builder.setContentTitle("New Affirmation"); 
     builder.setContentText(content); 
     builder.setSmallIcon(R.drawable.wuno_launcher); // error here cannot resolve symbol 
     return builder.build(); 
} 

ただし、次の図のようにアイコンが追加されていることを確認しています。

enter image description here

+1

'ic_launcher'iconsは' mipmap'フォルダに置いてください。他のドロワブルを 'drawable'フォルダに移動してください(例えば' drawable-xhdpi') –

+0

おかげさまで私はそれを試してみます – wuno

答えて

3

を使用してrefferedいます。このようなことをしてください

builder.setSmallIcon(R.mipmap.wuno_launcher) 
+0

ありがとうございます。だからこそ、ic_launcherはうまくいかなかったのです。だから私のカスタムイメージのために私はdrawableでドロップします。しかし、ic_luancherはあなたの答えを使うだけです。 – wuno

+0

ようこそ。 – Masum

1

のGoogleドキュメントによると、mipmapアイコンは唯一のもapp_iconとして知られているランチャーアイコンのために使用されています。あなたの代わりに描画可能の使用ミップマップを持っているので、あなたはミップマップフォルダの画像を使用する場合はミップマップアイコンはR.mipmap

Here is a good explanation of the same

関連する問題