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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:37:51+00:00 2026-06-16T23:37:51+00:00

I have multiple variables to pass from one activity to another. I have this

  • 0

I have multiple variables to pass from one activity to another.

I have this in the first activity:

public void onClick(View v) {
    switch(v.getId()){
    case R.id.bStartGame:
    Intent i = new Intent(StartScreen.this, GameScreen.class);
    Bundle extras = new Bundle();
    extras.putString("Name 0", sName0);
    extras.putString("Name 1", sName1);
    extras.putString("Name 2", sName2);
            .
            .
            .
    i.putExtras(extras);
    StartScreen.this.startActivity(i);
    finish();
    break;

In the second activity, I have this:

 Intent i = getIntent();
 Bundle extras = i.getExtras();
 String name0 = extras.getString("Name 0");

 TextView test = (TextView) findViewById(R.id.tvTEST);
 test.setText(name0);

However, the textview shows nothing when I do this. How can I fix this?

EDIT: In the first activity I have:

 name0 = (EditText) findViewById(R.id.etName0);
 sName0 = name0.getText().toString();

and the same for all the other names with their relevant references.

Also, just for clarification, name0 is the edittext, sName0 is the string and “Name 0” is the key.

  • 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-16T23:37:53+00:00Added an answer on June 16, 2026 at 11:37 pm

    Nothing is wrong in the code you’ve shown.

    String name0 = extras.getString("Name 1");
    

    name0 here has the correct value: "". If it was not sending the extras properly, it would be null, and would give you a NullPointerException on .setText().

    extras.putString("Name 1", sName0);
    extras.putString("Name 1", sName1);
    

    Here, you’re overwriting "Name 1" with the value of sName1, which is probably blank. I’d assume that you want to send sName0 instead.

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

Sidebar

Related Questions

I have this ingredients array which contains multiple variables (like name, icon, value etc.).
I have 2 lists, each with multiple variables (I think this is the correct
I have a text that has multiple occurrences of variables in this format: Example
I am trying to pass a data from one click function to another and
I have text documents like the following which contain single and multiple variables: title::
I had a question about Java Class Path variables. If I have multiple jars
I have multiple UpdatePanels on a webpage, one inside UserControl (Purple ColorBox as show
I have this method: public static int what(String str, char start, char end) {
How can I pass multiple variables between PHP files using jquery with json? Ex:
I am trying to pass values from a multiple select listbox through Ajax to

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.