开发者

Translate English Text to Hindi in Android

开发者 https://www.devze.com 2023-03-09 12:42 出处:网络
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 dose

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

精彩评论

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