Reputation: 13
My notification works with a constant small icon I generated using Image Asset in Android Studio. I am now trying to set the small icon corresponding to a number that the user inputs. I have made the drawable notification icons using Image Asset. Drawable notification icons I made myself
My code is as follows:
int[] icon = {R.drawable.ic_0, R.drawable.ic_1, R.drawable.ic_2, R.drawable.ic_3, R.drawable.ic_4, R.drawa and so on
mBuilder.setSmallIcon(icon[n]); //where n is an int the user has entered.
It works for R.drawable.ic_0 and R.drawable.ic_1. R.drawable.ic_10 comes out as a grey square, and then R.drawable.ic_11 to R.drawable.ic_40, and R.drawable.ic_2 to R.drawable.ic_9 give me "bad notification" errors.
Upvotes: 0
Views: 261
Reputation: 13
OP here.
My code started working! I didn't do anything other than unplug my phone to cook some food, and then plug it back in to re-test the code. Thank you for reading!
Upvotes: 0