It's a feature. Resources generate Java files (R.java) which means the name
of your resources must be valid Java identifiers. And "switch" is a keyword
in the Java programming language. This means your resource cannot be called
switch (or if, for, while, etc.)

On Tue, Mar 15, 2011 at 2:57 AM, gakarak <[email protected]> wrote:

> Hi,
> I want to set the id of a Button equal to "switch".
> Ie I simply add the following code in the xml-file:
>   <Button
>        android:layout_width="fill_parent"
>        android:layout_height="wrap_content"
>        android:text="switch"
>        android:id="@+id/switch"
>        />
> After that aapt gives me the following error:
> [2011-03-15 11:42:58 - TestAndDevProject] /opt/dev/android-2.2/android-
> sdk-linux_86/platform-tools/aapt: /lib/libz.so.1: no version
> information available (required by /opt/dev/android-2.2/android-sdk-
> linux_86/platform-tools/aapt)
> [2011-03-15 11:42:58 - TestAndDevProject] /home/ar/workspace-
> android-2.2/TestAndDevProject/res/layout/testview_activity_layout.xml:
> 37: error: invalid symbol: 'switch'
>
> Ie I can not assign value "switch" for the id-field when declaring
> View.
> If I write "switch0" or something else, then the error will not.
>
> my sdk details: Android Platform SDK 2.2 API 8.
>
> Of course, the value of "switch" to me is not essential, but I would
> like to know this is a bug or a feature? :)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" 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-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to