Issue
According to this thread I need to use @+id/ for the first time to make resource be created.
But what if I forget that this resource was previously created and create it again with @+id/? I have some input and set nextFocusDown for the element that is still not declared.
<EditText
...
android:nextFocusDown="@+id/myinput2"/>
200 lines below I create this element with @+id because I forgot that it's already declared.
<EditText
...
android:id="@+id/myinput2"/>
It works like this but can it cause an issue?
Solution
Some quick definitions:
@+id/foomeans "use the idfoo, and create it if it doesn't exist"@id/foomeans "use the idfoo" (which will be an error if the idfoodoesn't exist)
Previously, there were reasons to prefer @id over @+id (the system could tell you if you tried to reference a view via an id that didn't exist), but now the system is smart enough that even writing android:layout_below="@+id/idthatdoesntexistanywhere" will be tagged as an error:
So just always use @+id.
Answered By - Ben P.

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.