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

  • Home
  • SEARCH
  • 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 6645689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:19:10+00:00 2026-05-26T00:19:10+00:00

My question is a bit basic. I’ve been learning to code on JAVA and

  • 0

My question is a bit basic. I’ve been learning to code on JAVA and android. Here I am a bit confused on how to call the values that I have sent via an intent.

In my first activity this is the intent that I am using.

            Intent intent = new Intent(MainActivity.this, Secondactivity.class);
            String regName1 = regName;
            intent.putExtra(regName1, regNameSplit[0]);
            startActivity(intent);

Here regName1 will contain three values. SessionID,URL,Name split by “-“.

In my SecondActivity

public class Secondactivity extends Activity {
public final String TAG = "###---Secondactivity---###";
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.secondactivity);
    Log.i(TAG,"before if statement");
    if (getIntent().getStringExtra("regName1") != null){
        getIntent().getStringExtra("regName1").split("-");
        String[] str = "regName";
        Log.i(TAG, ""+str[0]+str[1]+str[2])
    }
}

}

The value if regName1 always comes as null.

  • 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-26T00:19:11+00:00Added an answer on May 26, 2026 at 12:19 am

    This line

    intent.putExtra(regName1, regNameSplit[0]);
    

    Needs to be like this instead

    intent.putExtra("regName1", regNameSplit[0]); // note the quotes
    

    BUT you are using regName1 as a variable… how do you expect the second class to know that variable?

    Use a string resource instead.

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

Sidebar

Related Questions

This may be a bit of a nooby question, I have been trying to
A bit of a basic question, but one that seems to stump me, nonetheless.
My question might be little bit different or basic for advanced users here. I
This is pretty much a basic question since I got a bit confused When
I know this maybe a very basic question but I'm having a bit of
My question is similar to Engram's here , but my question goes a bit
I have a bit of an unusual question. I'm running an old DOS game
I know this question has been asked a bit before. But looking around I
let me tell you a bit about where this question came from. I have
A bit of a basic question but how may I check if a anchor

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.