Did you give the application INTERNET permission in the manifest?
On Oct 14, 8:58 am, redmapleleaf <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I wish to use the package com.google.api.translate to write an android
> translator application. However, I tried all day yesterday and nothing
> is working. Although I got no error warning, I am not getting anything
> back from the translator. Do you know if there is something
> fundamentally wrong with my code? Why wouldn't the package
> com.google.api.translate works in an android application environment?
>
> Thank you for your help,
>
> Redmapleleaf
>
> PS. Here is a copy of my code
>
> package com.google.android.translator;
>
> import com.google.api.translate.Language;
> import com.google.api.translate.Translate;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class AndroidTranslator extends Activity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> TextView tv = new TextView(this);
> String translatedText="Hello World";
> translatedText = myTranslator("Hellow World");
> tv.setText(translatedText);
> setContentView(tv);
>
> }
>
> private String myTranslator(String phrase) {
> String translatedText=null;
> if(phrase==null) phrase="No Translation";
> try {
> translatedText = Translate.translate(phrase,
> Language.ENGLISH, Language.FRENCH);
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> return (translatedText);
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---