How to Declare and Set a Drawable to an Integer object


1. Add a drawable to your project named myicon.

2. In the MainActivity.java file, add the below line to the onCreate method.

int myIcon = R.drawable.myicon;

3. Compile and run!

Next Recommended Article: