Posts

Showing posts from October, 2016

R in the Android

In Android developing you are using res folder to create resources like music, images, layout files and strings. But when you want to deal with your resources in your program, How can you do this? If you are using Android studio, the IDE creates for you class names R.java, It is public static have all values you need to refer to your layout. Where can I find it? okay usually If you press ctrl and click on any class in your code, Android studio opens it for you. However, in recent versions of Android Studio if you did that with R class it will open the resource file instead of R.java file. It is okay you can click double shift and search for R.java, you will find more than one, the one we need is the same have your package name. R class has inner public static classes those have static final integers, but why integers? Okay all methods you use to refer for resources like setContentView() takes int parameter (you can check their code, Android is open source). Good Luck.