Android: Dynamically set notification icon
<p>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.
<a href="http://i.stack.imgur.com/2xA16.png" rel="nofollow">Drawable notification icons I made myself</a></p>

<p>My code is as follows:</p>

<pre><code>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.
</code></pre>

<p>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. </p>