Can someone help me with my Syntax/Methodology? I would like to set up a bunch of different views in a viewgroup. My code fails at the addView method.
Unfortunately, I can’t find jack for examples (which is how I learn) using the ViewGroup class online.
Thanks all.
public class TileView extends ViewGroup {
private TestClass mTestClass;
public TileView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initViews();
}
public TileView(Context context, AttributeSet attrs) {
super(context, attrs);
initViews();
}
public void initViews() {
addView(mTestClass);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
}
}
public class TestClass extends View{
public TestClass(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public TestClass(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TestClass(Context context) {
super(context);
}
}