I am learning Android from Notepad tutorial and one thing confuses me. Since Notepad2 in file notes_list.xml is used + with definition of id resource:
<ListView android:id="@+id/android:list"
<TextView android:id="@+id/android:empty"
But from what I have read + sign is nnecessary only when defining new resource and list and empty is not new, but it is provided by android. So why did they used + sign then? If you delete program runs anyway.
Probably habit or copy/paste. 🙂
You’re correct in that you don’t need it, the
@+id/syntax will define a new id if one with that name didn’t already exist. Since the Android framework idsandroid.R.id.listandandroid.R.id.emptyexist as part of the public SDK the two forms are functionally equivalent here. It’s slightly better for clarity/style to omit the + for framework ids since it avoids the confusion shown here.