I am trying to add another view to my GlSurfaceView however I keep kicking up errors.
glView = new GLSurfaceView(this);
glView.setRenderer(this);
setContentView(glView);
glView.setId(932203934);
int newID = glView.getId();
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, "a14e3ef0948eb58");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
//LinearLayout layout = (LinearLayout)findViewById(newID);
GLSurfaceView layout = (GLSurfaceView)findViewById(newID);
// Add the adView to it
this.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
//layout.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
I have added “setID” as the glView always gave -1, but now with this I get “java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child’s parent first.”
Clearly I am not doing this right so how do I had this additional view to the glsurfaceview?
Thanks
Anyone else having this problem….