findViewById(2131230729) what are these numbers?

Asked

Viewed 155 times

0

I’m analyzing a class from an Android app project, I’m new and didn’t understand these numbers within the findViewById(2131230729), within the parentheses was to have R.id."layout" as I do through that number to discover the Layout?

  • 2

    It is the id of an element. Every relation is in the class R.java.

1 answer

3

When you reference with the findViewById(), and put R.id.input, that id is a whole, all ids of its application take the reference of the id by a whole. This reference comes from the R.java, That’s where it’s safe ids. Ex:

     <EditText
         android:id="@+id/input"
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
         android:inputType="text"/>

The id @+id/input goes to the R.java as a whole, it is thus transformed to future reference of the findViewById, for example.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.