requestWindowFeature (Window.FEATURE NO TITLE); causing the App to crash?

L'Application crashs quand j'ajoute cette ligne

" requestWindowFeature(Window.FEATURE_NO_TITLE);

peut-être que la solution est très simple, mais je ne sais vraiment pas qui la réparer.

code Java:

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);

}

}

fichier XML:

<FrameLayout 
        android:id="@+id/fl01" 
        android:orientation="horizontal" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"/>  
1
demandé sur LetsamrIt 2012-03-16 16:19:26

2 réponses

vous devez appeler requestWindowFeature(Window.FEATURE_NO_TITLE); avant 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
répondu Franco 2012-03-16 12:21:20

faites simplement ceci :

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

}

vous devez déclar requestWindowFeature(Window.FEATURE_NO_TITLE); avant super.onCreate(savedInstanceState);

1
répondu Adnan Abdollah Zaki 2015-07-07 13:24:23