以下是logcat中的主要內容
by log Tag:AndroidRuntimebyLog Message:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demoone/com.example.demoone.StudentCenter}: android.util.AndroidRuntimeException: requestFeature() must be called before adding contentby PID:6098以下是源碼:
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.student_center); requestWindowFeature(Window.FEATURE_NO_TITLE); }直譯最后一句:requestFeature()必須在添加content之前先被調用。
看回源代碼,還真的是這樣,調換位置就好了,先設置標題,再加載布局文件。
新聞熱點
疑難解答