Search code examples
androidr.java-file

What does R.id.myView refer to?


Could you please tell me what three single components of this name refer to?

R.id.myView

Solution

  • R - R.java is an auto-generated file by aapt (Android Asset Packaging Tool) which contains resource IDs for all the resources of res directory.

    public final class R 
    extends Object 
    

    .id - Find view using its id "defined by you"

    public static final class R.id 
    extends Object 
    

    myView - It is the view that you defined using the android:id="@+id/your_view" attribute in your XML file.

    So, finally we can find or identify any view using R.id.your_view.