Home >Java >javaTutorial >What does R mean in java

What does R mean in java

angryTom
angryTomOriginal
2020-02-03 09:36:454785browse

What does R mean in java

What does R mean in java

R stands for resource in Java, and the full form is Resource.

Resources are used almost everywhere in project development, including layout, string, drawable, raw, style, theme, etc. These resources will be packaged into APK (res folder) during the compilation process or packaged into independent resource APK packages (such as framework-res.apk).

But these resources will be given unique IDs, namely resource indexes, to facilitate system access.

These resource indexes are eight-digit hexadecimal integers generated by Android's tool AAPT (Android Asset Packing Tool).

What does R mean in java

The middle 02 position value represents the type of resource corresponding to the resource ID, which are:

02: drawable

03: layout

04: values

05: xml

06: raw

07: color

08: menu

R.java file example

public final class R {
    public static final class attr {
    }
    public static final class drawable {
        public static final int icon=0x7f020000;
    }
    public static final class layout {
        public static final int main=0x7f030000;
    }
    public static final class string {
        public static final int app_name=0x7f040001;
        public static final int hello=0x7f040000;
    }
}

(Related video tutorial sharing: java video tutorial)

The above is the detailed content of What does R mean in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn