2012-01-22 12 views
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 ProblemStartActivity型の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); 
    } 
}  

答えて

0

のOnInit()メソッドの "@Override" 注釈を削除

+0

は働いたこと、ありがとう:) – user1163782

関連する問題