Why we will create for this application the icon? In programming it is very important to practice what we have learned, otherwise we gonna forget them.
If you made the tutorial of Teki, then there you saw that we have made also an icon for the game. This chapter will be very similar for this.
If you didn’t do the previous chapters, then from GitHub you can download the starter project for this chapter.
Step 1 – Create the icon
For the icon we gonna use a new icon. You can see it at the beginning of this tutorial, which contains the Firebase and the Android logo.
Click on the “drawable” folder with the right mouse button, select “New”, then “Image Asset”.
In the popup window we will see the “Foreground layer”. In this window we can select the icon from our computer. You can see the detailes below.
Icon Type – Select Launcher Icons (Adaptive and Legacy)
Name – Choose a name. I will give it the name app_icon. Be careful, don’t use uppercase, because it is not accepted. Intead use the snake case.
Layer Name – Can stay the generated app_icon_foreground
Asset Type – We are going to use an Image.
Path – You can open the browser with the folder icon. Do it select from the extracted assets folder the app_icon.png file.
Resize – After the selection of the image it will be out of the safe zone in some previews. With this resize slider you can set the size. I will set it to 66%.
We are done with the settings of the “Foreground layer”. Now open the “Background layer”.
Layer Name – Can stay the autogenerated name again.
Asset Type – Select the “color” option.
Color – The background of our app will be the color of the selected image. So click on the color, and paste in this hexa-color there: #1DA1D2
We leave here everything as it is. If you are done, then click on the “Next” button, then on the “Finish”.
Step 2 – Modify the AndroidManifest.xml
Still our app icon won’t be changed. After the creation we have to set the icon in the AndroidManifest.xml file.
If you open the “Project” tab at the left side of the window, and in the “Android” view, inside the “manifest” folder you will find the AndroidManifest.xml file. Open it.
Inside the “<application>” tag there is the line:
… change it to
Finally run the app, and the icon will be changed, good work. 😉
The code is available on GitHub, check it out.
I hope the description was understandable and clear. But if you have still questions, then leave me comments below! 😉
Have a nice a day! 🙂