I have over 30 clickable imagebutton views that I want to create programatically instead of using multiple xml files. Can someone please explain how I can do so? For each imagebutton, I need to:
-
be able to name and set the ID of each view programatically, like R.drawable.button01, R.drawable.button02, etc. since I would need to refer back to them later with findViewById().
-
each imagebutton is clickable and I have a button pressed down image for each button so I need to figure out how to assign the button press actions to each button dynamically instead of using a xml resource file for each.
Thanks in advance.
Take any of the layout as root like Linear or Relative initialize it ..
I hope this solves your problem.