Here is a tip on how to use generated layout id's. If your layout has
id="@+id/foobarid" -- THIS IS WRONG
this will NOT work with findViewById method. You have to do it this
way
android:id="@+id/foogarid" -- CORRECT
In both cases, the build will generate R.id.foobarid, but findViewById
(R.id.foobarid) will not find it unless you use the "android:"
namespace in the layout file. That seems to be inconsistent and
should be considered an Android bug because it is really, really hard
to discover what is wrong. In addition the SDK documentation actually
shows the WRONG way to do it. So at the very least that is a bug in
the documentation.
ERROR IN DOCUMENTATION - see
http://developer.android.com/guide/topics/resources/available-resources.html
--- quote --
When declaring an ID value for an XML tag, use this syntax. Example:
<TextView id="@+id/nameTextbox"/>, and refer to it this way in Java:
findViewById(R.id.nameTextbox)
-- end quote --
The above example is WRONG. It should be this way -- <TextView
android:id="@+id/nameTextbox"/>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---