Normally, when I switch/case my views onClick, I have no problems because they were defined in the XML and have ID’s so I use:
switch(v.getID())
{
case(R.id.someButton):
{
// do something
}
default: // bla
}
However, I am now defining my views programatically and so they don’t have a static ID.
How should I now switch on these views? if I tried getID() on the views it’s not allowed because it isn’t static.
Ideas? Thanks.
EDIT:
You should create ids.xml file and refer it in your code while creating view programmatically.