我想根據指南製作一個簡單的Android應用程序。我正在使用下面的代碼,但它給了我幾個錯誤。它試圖覆蓋onCreate()
方法時抱怨。確切的錯誤在下面。任何人都可以解釋我在這裏犯了什麼錯誤嗎?Android活動中未定義的錯誤
package com.bignerdranch.android.geoquiz;
import android.os.Bundle;
public class CheatActivity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cheat);
}
}
確切的錯誤:
The method onCreate(Bundle) is undefined for the type Object
The method setContentView(int) is undefined for the type CheatActivity
The method onCreate(Bundle) of type CheatActivity must override or implement
a supertype method
由於錯誤指示,代碼是*不正確。 – user2864740
代碼不正確。你需要''擴展''活動'。 – Emmanuel
停止downvoting,他只是要求幫助,並犯了一個錯誤。它不值得-6或更多。 – Paul