I've develop android application, and one question.
As you know, When we use LiveActivity, we must specify @id/android:list for ListView ID.
But, When I use @+id/android:list instead of @id/android:list, it is working fine.
What is different between @+id/android:list and @id/android:list ??
The fundamental difference between @
and @+
is that @+
is signaling that you need to add a new id, the @
by itself tells the compiler to look for an existing id.
As you know, When we use LiveActivity, we must specify @id/android:list for ListView ID.
No, you do not. You must specify @android:id/list
for the ListView
ID for use with ListActivity
.
But, When I use @+id/android:list instead of @id/android:list, it is working fine.
No, those will give you compile errors. Colons are not valid characters in Java field names, and so those IDs are illegal.
Switching back to legal Android syntax, if you are declaring your own ID (no android:
in the value), the first time you use the ID in a file, you are supposed to have the +
sign. The second and subsequent times, the +
sign is not needed, though it seems to cause no harm if you have in there as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With