crystalcoraldsouza / microsoft-translator-java-api

Automatically exported from code.google.com/p/microsoft-translator-java-api
0 stars 0 forks source link

Function Translate() returns: "android.widget.EditText@b74a0218" #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
I excepted the Translated Text

What version of the product are you using? On what operating system?
I try with the versions: 0.3, 0.4, 0.6.1 and 0.6.2 on Android 2.3.3 and 4.2.2. 
The same issue...

Please provide any additional information below.

###In AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

###And in Main.java:

import android.os.Bundle;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
import android.view.View;
import android.view.View.OnClickListener;

import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;

public class Principal extends Activity {

    private Button btraducir;
    private EditText eentrada;
    private EditText esalida;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_principal);

        btraducir = (Button) findViewById(R.id.bTraducir);
        eentrada = (EditText) findViewById(R.id.eEntrada);
        esalida = (EditText) findViewById(R.id.eSalida);

        btraducir.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (eentrada.length() == 0) {
                    esalida.setText("No hay texo para traducir.");
                }
                else {
                    String textotraducido = "";
                    String textoatraducir = eentrada.toString();

                    Translate.setHttpReferrer("<MyReferrer>");
                    Translate.setKey("<MyKey>");

                    try {
                        textotraducido = Translate.execute(textoatraducir, Language.ENGLISH, Language.SPANISH);
                    }
                    catch (Exception e)
                    {
                        textotraducido = e.toString();
                    }
                    esalida.setText(textotraducido);
                }
            }   
        });

    }

}

Please Help!. Thanks in advance.

Original issue reported on code.google.com by mickmeta...@gmail.com on 26 Mar 2013 at 5:38

Attachments: