Cannot instantiate the type ViewGroup
I tried to make a ViewGroup before with a constructor but i always had the same message above.
Tomas
Edit:
Should i use FrameLayout:
http://stackoverflow.com/questions/...w-to-declare-viewgroup-without-layout-xml-fil
			
				B4X:
			
		
		
		FrameLayout fl = new FrameLayout(fl.getContext);
	Edit 2:
Now i'm trying this:
			
				B4X:
			
		
		
		 /**
     * Register the SettingView to the CanvasView.
     */
    public void RegisterSettingView2(PanelWrapper Panel, SettingView sv, boolean bClearAllVisibileInEraserSetting) {
       
       FrameLayout fl = new FrameLayout(ba.applicationContext.getApplicationContext());
        fl.setLayoutParams(new FrameLayout.LayoutParams (Panel.getObject().getWidth(), Panel.getObject().getHeight()));
        
        Panel.setObject(fl);
        getObject().setSettingView(Panel.getObject(), sv, bClearAllVisibileInEraserSetting);
        
    }
	Note the (ba.applicationContext.getApplicationContext()); i wasn't able to use fl.getContext as it said
The local variable fl may not have been initialized
Findings:
			
				B4X:
			
		
		
		Sub mnuRegister_Click
   pnlCanvas.AddView(cv,0dip,0dip, 100%x, 100%y)
   
   cv.RegisterSettingView2(pnlPen, sv, True)
   'pnlPen.AddView(sv,0dip,0dip, 100%x, 100%y)
   sv.showView(1)
End Sub
	Doesn't raise any errors.
'pnlPen.AddView(sv,0dip,0dip, 100%x, 100%y)
uncommenting this raises:
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
I also checked if fl.getparent() is null which it is also.
Here's the decompiled setSettingView from the jar:
			
				B4X:
			
		
		
		  public void setSettingView(ViewGroup paramViewGroup1, ViewGroup paramViewGroup2, boolean paramBoolean)
  {
    super.setSettingView((SettingView)paramViewGroup2);
    this.Q = null;
    this.R = null;
    this.N = paramViewGroup2;
    this.P = paramViewGroup1;
    if (this.P != null)
      this.P.addView(this.N);
    this.S = paramBoolean;
  }
	
			
				Last edited: