-2

can any body explain me what What is the difference between android:id="@+id/btnSet" and android:id="@id/btnSet"in android XML?

when to use that plus, when not? it would be great with a good explanation.

Tharif
  • 13,794
  • 9
  • 55
  • 77
Mosharrof Rubel
  • 106
  • 2
  • 7

2 Answers2

2

android:id="@+id/btnSet" means you are adding a widget or view with the name btnset in your R.java file.

android:id="@id/btnSet" means you are using or referring an already defined widget or view with the name btnset

kgandroid
  • 5,507
  • 5
  • 39
  • 69
1

@id/btnSet will try to use existing id "btnSet" while the @+id/btnSet will always create that ID. :) If you use @id/btnSet and the ID doesn't exist, you can encounter an exception.

Slavenko Miljic
  • 3,836
  • 2
  • 23
  • 36
Vedran Kopanja
  • 1,259
  • 12
  • 23