Reputation: 466
What is the correct (or any) way to remove a view that has been set using setContentView. The application is basically a NativeActivity application that uses openGL and as such has no layouts/views defined. I needed to add a splash screen very early on and so from java create a class derived from SurfaceView to display a resource image. This all works fine and I set the SurfaceView using
mySurfaceView = new SplashScreen(getApplicationContext());
setContentView(mySurfaceView);
The problem is i dont seem to be able to remove this view to see my openGl application. I can hear the audio and it seems to be running, but this splash screen is topmost. Ive tried setting visibility, using setContnetView(null), setting a basic blank textview instead, but nothing seems to work.
Any ideas would be great.
Thanks
Upvotes: 0
Views: 1547
Reputation: 75645
There's no unsetContentView()
. Use Fragment
for your splash screen content and have your SurfaceView
there. Add it from code and then remove when done. Or just have set View.GONE
visibility on your splash SurfaceView
Upvotes: 0
Reputation: 10338
setcontentview can be called only once in a activity. You can try to setcontentview in if-else condition but it can be done only once and only in oncreate.
Upvotes: 2