0
我是新手,正在使用最近購買的電子書。現在我必須創建我的第一個應用程序:它應該給出一個文本並說出你好(在我的情況下,它是'SagHallo'的德語)。 我一遍又一遍地讀了這本書中最後整整2個小時的2個網站,但我不會繼續:(我正在使用Eclipse。 請問你能解釋一下我的錯嗎? 錯誤是:The method onInit(int) of type StartActivity must override a superclass method StartActivity.java /SagHallo/src/de/androidnewcomer/saghallo line 22 Java Problem
方法StartInctivity類型的onInit(int)必須重寫超類方法
而且我的代碼:
package de.androidnewcomer.saghallo;
import java.util.Locale;
import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
public class StartActivity extends Activity implements OnInitListener {
private TextToSpeech tts;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tts = new TextToSpeech(this, this);
}
@Override
public void onInit(int status) {
tts.setLanguage(Locale.GERMAN);
tts.speak("Hallo!", TextToSpeech.QUEUE_FLUSH, null);
}
}
謝謝,制定出:)。 – user1163782