R.Java is the automated generated java file which includes all the resource Id's we are using in our project during the development.
R.java shown under the gen folder into your project. When your are working on any project few fields are always present into the R.java file . Lets looks into my AndroidButton project which is discussed at below link
AndroidButton_Example
In above R.java file few fields are always present into any android project.
1. public static final class dimen
It describe the android default screen margin , here you can set default values to set margin which is followed throughout the android application UI.
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
Here two dimesion fields are define for horizontal and vertical margin.
2.public static final class drawable
It describe about the image resources which you used into your projects by default you see an ic_launcher
public static final int ic_launcher=0x7f020000;
3.public static final class id
This class include the view , viewgroups , container's id's which you are using into your project like , Button , Layouts , ToggleButton , Checkbox and etc. all resources id's are defined into this class.
public static final int action_settings=0x7f080001;
public static final int button1=0x7f080000;
Whatever resource you are using into your application all the resource goes under a class in R.java as per their features like :
R.java shown under the gen folder into your project. When your are working on any project few fields are always present into the R.java file . Lets looks into my AndroidButton project which is discussed at below link
AndroidButton_Example
In above R.java file few fields are always present into any android project.
1. public static final class dimen
It describe the android default screen margin , here you can set default values to set margin which is followed throughout the android application UI.
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
Here two dimesion fields are define for horizontal and vertical margin.
2.public static final class drawable
It describe about the image resources which you used into your projects by default you see an ic_launcher
public static final int ic_launcher=0x7f020000;
3.public static final class id
This class include the view , viewgroups , container's id's which you are using into your project like , Button , Layouts , ToggleButton , Checkbox and etc. all resources id's are defined into this class.
public static final int action_settings=0x7f080001;
public static final int button1=0x7f080000;
4. public static final class layout
This class include the Id's of layouts that you include into the sub folder layout under the res .
public static final int activity_main=0x7f030000;
5.public static final class menu
Under this class name menu's xml files are defined. all the Id's for menu xml files are defined under the menu class.
public static final int main=0x7f070000;
6. public static final class string
This class includes all the string resource Id's of the project.
public static final int action_settings=0x7f050002;
public static final int app_name=0x7f050000;
public static final int click=0x7f050003;
public static final int hello_world=0x7f050001;
Whatever resource you are using into your application all the resource goes under a class in R.java as per their features like :
- Images related resources goes under the drawable .
- String used into your application goes under the string class.
- Array related data goes into array class.
- Dimension related Id's goes under the dimen folder. etc..



0 comments:
Post a Comment