So, in my application I have a grid of buttons. Each one is set to addView(closedVies) and then removeView(openView) if one was displayed. The views that I’m adding contain several checkboxes and on each checkbox I will be setting an onClickListener as well.
I have it working my way, but is there an easier or more efficient way it could be done?
There will be a background behind the checkboxes that will connect to whichever button opened it. I have that figured out just haven’t implemented it yet.
The checkboxes are in a linearlayout defined in XML
From Samsung mobile
Here is basically what it will look like:

There is a couple of projects from Romain Guy. There is a project named PhotoStream that uses a GridLayout. This is sort of like the LinearLayout but we specify the number to rows and columns. So the childs to this layout are automatically laid out as a grid. Its a good alternative to what you have done so far.
Here is the link to the project.. This is the link for the gridlayout. I recommend you checkout the project and take a look at it.