0

I am setting the required drawable to Notification.Builder but it says cannot resolve. I have tried to use the ic_launcher which would not work so I added my own wuno_launcher and that will not work either.

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();
} 

But I am sure I have the icon added as you can see in the picture below.

enter image description here

wuno
  • 9,547
  • 19
  • 96
  • 180

2 Answers2

3

If you use mipmap folder image so you have use mipmap instead of drawable. Do something like this

builder.setSmallIcon(R.mipmap.wuno_launcher)
Masum
  • 4,879
  • 2
  • 23
  • 28
  • Thanks man. So that was why the ic_launcher would not work. So For my custom image I would drop in drawable. But the ic_luancher just use your answer. – wuno May 17 '16 at 15:33
1

According to the Google documentation, mipmap icons are used only for launcher icon which is also known as app_icon. Mipmap icons are reffered by using R.mipmap

Here is a good explanation of the same

Community
  • 1
  • 1
Alex Chengalan
  • 8,211
  • 4
  • 42
  • 56