开发者

Translate English Text to Hindi in Android

I want to convert a text in English to Hindi and display it in the TextView.I followed the following URL http://android-er.blogspot.com/2009/10/androidtranslate-using-google-translate.html but it dosen't seems to work. Is there any other method to do it?Help me out.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.read_view);
    mTts = new TextToSpeech(this,this);
    try {
        setTranslate();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

private void setTranslate() throws Exception {
 String OutputString = Translate.execute("hello",
         Language.ENGLISH, Language.HINDI);
 TextView tv = (TextView) f开发者_如何学GoindViewById(R.id.translate);
 tv.setText(OutputString);
}

Here I am trying to display hindi text in the TextView id "translate"


make sure your application does have internet permission

android.permission.INTERNET

add google translate api jar i.e google.api.translate-java-0.90.jar

Also check this client api it comes useful some times when u want to handle certain events and requests with ease


Microsoft Bing Translator offers a translator for this english-hindi and its completely free for a limited searches. http://www.microsoft.com/web/post/using-the-free-bing-translation-apis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜