Additional Id/tag for view?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Additional Id/tag for view?

Postby ubit » Sun Jul 08, 2012 3:23 pm

Hi,

i am trying to add additional info (in fact an id i created in a resource file) to a view (e.g. a button) via xml.

I defined the item:

<item type="integer" name="my_id">@+id/my_id</item>

Then i tried to use the id in a tag in the button:

<button...
tag="@id/my_id"
...

of <button
tag="@integer/my_id"
...

If i retrieve the tag with getTag() it results in "@.....". The number after the "@" is correct, but i thought i can retrieve the number only. What the hell does the @ in front of "my" number?

Any ideas how i can create own id's (integer-numbers) and attach them via xml to a button?

What i really want is to retrieve this id and put it into a switch/case to decide which function the button should execute as i have to use different layouts with different buttons (and sometimes different buttons have the same function) that are "rooted" through a central dispatcher.

Best regards, Udo
ubit
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Jul 08, 2012 3:12 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests