Saturday, March 30, 2013

Difference between @+id and @android:id, android

While working on a test android application, I noticed two different way of defining ids i.e. @+id and @android:id. Out of curiosity, I googled differences between them and highlighted good differences between two.

1. @+id:
Example <Button android:id="@+id/button_add" ..../>
By defining @+id/button_add we are creating an id named button_add in the namespace of our application which can be referred in our application as @id/button_add.

2. @android:id
 By defining @android:id/list means you are referring to an id defined in the android framework namespace. The android framework knows only about the ids in the android namespace. Android framework identifies a list element using android:id/list. It won't work if you change list to any other id like @android:id/listAddNew.

Will add more details about it in future post.

No comments:

Post a Comment