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 6222067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:14:54+00:00 2026-05-24T08:14:54+00:00

this is my first time on this forum, so forgive me if my question

  • 0

this is my first time on this forum, so forgive me if my question seems odd. I’ll try to be as thorough as possible.
I am creating a translation program.
this program has a menu activity, translate activity, addword activity.
The three activities are linked together via intents and they are
added in the manifest file.
In the translate activity I want to create a method for translating.
After I press the translate button, the program crashes.

public class VertaalActivity extends Activity {
private Button vertaal;
private Button terug;
private EditText ET_NL;
private EditText ET_EN;
private ArrayList<String>nlWoorden = new ArrayList<String>();
private ArrayList<String>enWoorden = new ArrayList<String>();

public void Vertaal(){

    String woord = ET_NL.getText().toString();

        if(nlWoorden.contains(woord)){
            int i = nlWoorden.indexOf(woord);
            ET_EN.setText(enWoorden.get(i));
        }else{
            ET_EN.setText("Woord niet gevonden");
        }

}

public void ArrayVullen(){
    nlWoorden.add("auto");
    nlWoorden.add("bord");
    nlWoorden.add("trein");
    nlWoorden.add("spel");
    nlWoorden.add("scherm");
    nlWoorden.add("toetsenbord");
    nlWoorden.add("foto");
    enWoorden.add("car");
    enWoorden.add("plate");
    enWoorden.add("train");
    enWoorden.add("game");
    enWoorden.add("screen");
    enWoorden.add("keyboard");
    enWoorden.add("picture");
}

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.vertalerlayout);
    terug = (Button)findViewById(R.id.terug);
    vertaal = (Button)findViewById(R.id.vertalen);

    ArrayVullen();

    vertaal.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Vertaal();

            /*
             * Tested the toast and the toast shows the text 
             * 
            Context context = getApplicationContext();
            CharSequence text = "Hello toast!";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, text, duration);
            toast.show();
            */
        }

    });

    terug.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Intent intent = new Intent(VertaalActivity.this,MenuActivity.class);
            startActivity(intent);

        }
    });

}

}

  • 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-05-24T08:14:55+00:00Added an answer on May 24, 2026 at 8:14 am

    I can’t see that you get the EditTexts from your XML (like you do with the buttons). Before using ET_NL you need to do something like this:

    ET_NL = (EditText)findViewById(R.id.etnl); // Or whatever id you've declared in your layout XML
    

    Same thing goes for the ET_EN variable. Otherwise the will be null in your Vertaal() method, causing the app to crash.

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

Sidebar

Related Questions

It is the first time I ask a question on this forum. Sorry if
This is my first time posting a question to the forum, by the way.
Sorry, this is my first time using this forum. Apparently people can edit my
this is my first time asking a question here. I tried to be well
Ok, first off, I applogize if this question has been asked before, I've spent
Two things, first this is my first question in this forum and I do
First of all, I am aware that this question has been discussed many times
First time posting on this forum, and also very new to coding. Sorry if
This is my first time working with a WPF datagrid. From what I understand
This is my first time that I use WCF and Android. So, sorry for

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.