RequestWindowFeature (Window.FEATURE_NO_TITLE); what caused the application to crash?

Application crashes when adding this line

`requestWindowFeature (Window.FEATURE_NO_TITLE);

the solution may be very simple, but I really don't know who to fix it.

Java Code:

public class GLSurfaceCameraSurfaceDemo2Activity extends Activity { /** Called when the activity is first created. */ GLSurfaceView glSurfaceView; FrameLayout fl01; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); requestWindowFeature(Window.FEATURE_NO_TITLE); } 

}

XML file:

 <FrameLayout android:id="@+id/fl01" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"/> 
+1
android framelayout
Mar 16 '12 at 12:19
source share
2 answers

you must call requestWindowFeature (Window.FEATURE_NO_TITLE); before setContentView () ...

 public class GLSurfaceCameraSurfaceDemo2Activity extends Activity { /** Called when the activity is first created. */ GLSurfaceView glSurfaceView; FrameLayout fl01; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); } 
+12
Mar 16 '12 at 12:21
source share

just do this:

 @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main); } 

you must declare requestWindowFeature(Window.FEATURE_NO_TITLE); before super.onCreate(savedInstanceState);

+1
Jul 07 '15 at 13:24
source share



All Articles