Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:00:42+00:00 2026-06-13T18:00:42+00:00

Ok, my question is how to use Microsoft translation API for android? My problem

  • 0

Ok, my question is how to use Microsoft translation API for android? My problem is that I am creating an android app that will take input from one EditText, and when a button called Translate is pressed it will translate that text into another language, the translated text is then set to the another EditText… I have written some code, can you tell me what wrong with that code because its not working at all, it is not taking input and hence not producing output… thanks…

package kalex.globaltranslate;

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

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

public class TranslateActivity extends Activity implements OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        Translate.setClientId("MY ID");
        Translate.setClientSecret("MY SECRET KEY");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_translate);
        Button Trans = (Button)findViewById(R.id.translate);
        Trans.setOnClickListener(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_translate, menu);
        return true;
    }

    public void onClick(View v) {   
        //get the text entered
        EditText Input = (EditText)findViewById(R.id.input);
        EditText Output = (EditText)findViewById(R.id.output);



                String In =Input.getText().toString();
                //String Out;
                try {
                    String Out = Translate.execute(In, Language.AUTO_DETECT, Language.FRENCH);

                Input.setText(Out);
                Output.setText(Out);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }



}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:00:43+00:00Added an answer on June 13, 2026 at 6:00 pm

    Firstly, you may want to read a bit more about Java programming in general.

    Your object instances should be named with small letters. For example EditText Input should be EditText input.

    I recommend that you reorganize your program, by moving

    EditText Input = (EditText)findViewById(R.id.input);
    EditText Output = (EditText)findViewById(R.id.output);
    

    in the beginning, after the “Trans” instantiation. Then make global variable of those objects, so you can access them in the OnClick event.

    Your onClick method doesn’t check the id of the view which is passed and you may shoot yourself in the foot like this. It’s common to make a switch statement with cases for all views which have listeners.
    Alternatively – you can also have dedicated ClickListeners for all elements (less efficient, but still systematic):

    private OnClickListener translateClick = new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                        // TODO
                }
            };
    

    and set it to your translate button – trans.setOnClickListener(translateClick);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question from certification exam: You use Microsoft Visual Studio 2010 and Microsoft .NET Framework
I am writing a C++/MFC application that will use Microsoft Access to store data.
Question I use celery to launch task sets that look like this: I perform
Question: How to use ssh & scp from the Windows command prompt? I remember
i have a question how to use an alias from a select query: $timecheck
I have a simple question: if I use URLConnection.setUseCaches(true) when loading something from web,
We use Microsoft Ajax (ajaxmin.tasks) approach which described in this one (http://stackoverflow.com/questions/5043504/using-microsoft-ajax-minifier-with-visual-studio-2010-1-click-publish) to minify
Question: I use the code found at http://support.microsoft.com/kb/306273 to add a windows user. The
The two WWW-Authenticate additions Microsoft makes use of that I am currently aware of
The Microsoft link here lists three methods that we can use. But how do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.