Android: understanding R.Java

Understanding the R.Java class in Android: What is R.Java ??

The Eclipse ADT automatically generates a, which keeps track of all the application resources, in hello\gen as follows:

package com.mytest;
public final class R {
    public static final class attr {
    public static final class drawable {          // Inner class R.drawable
        public static final int icon=0x7f020000;  // Resource ID R.drawable.icon
    public static final class id {                // Inner class
        public static final int textview=0x7f050000;  // Resource ID
    public static final class layout {            // Inner class R.layout
        public static final int main=0x7f030000;  // Resource ID R.layout.main
    public static final class string {            // Inner class R.string
        public static final int app_name=0x7f040001; // Resource ID R.string.app_name
        public static final int hello=0x7f040000;    // Resource ID R.string.hello
The (R stands for resources) indexes all the resources used in this application in the inner classes attrdrawableidlayout, and string
For example, 
the inner class layout's property main (R.layout.main) references res\layout\main.xml
the inner class string references res\values\strings.xml
the inner classdrawable's property icon references res\drawable\icon which keeps the images used as icons in "apps" menu.

No comments :

Post a Comment

Your Comment and Question will help to make this blog better...