2012-01-22 62 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 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); 
    } 
}  

回答

0

上的OnInit()方法中删除 “@Override” 注释

+0

谢谢,制定出:)。 – user1163782

相关问题