In the XML layout (near the end of the video, starting at about the 4:30 mark) some of the TextView constraints are to “@+id/seekBar” and some are to “@id/seekBar” (and equivalent)
As I understand it, it probably doesn’t matter, but it’s likely to be confusing to anyone who is watching closely.
1 Like
Good catch here
In our case here, there is not much difference.
Using the @+id/viewName
, you’re telling Android that you’re creating/accessing a resource you created and if it is not in the R
file then it should be added to that file.
In our case, @+id/seekBar
has already been created previously and has been added to the R
file so it exist there.
This means you can simply access it using @id/seekBar
It’s best to always use @+id/seekBar
just in case you’re entering the xml manually.
By adding the +
sign, you wont encounter any compile errors related to accessing a resource that does not exist in the R file.
Note: The R
file is automatically generated for you and it contains unique integer ids for your resources.
1 Like