Android Basics – What is an R file ?

R is a Java Class file which is autogenerated by Android for your Project. It contains a list of all Resources being used.

For example if you have the following TextView in your Layout

<TextView
android:id=”@+id/helloId”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Hello Android !!”/>

Android will create the following entry in the R file for this ID.

public static final int helloId=0x7f0c0069;

This helps us to reference this UI component in our Activity Class.

Author: codesmartly

I am Enthusiastic about Learning new things and sharing my Knowledge. I like programming and have a pretty good background in Computer Science.

One thought on “Android Basics – What is an R file ?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s