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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:57:50+00:00 2026-06-11T02:57:50+00:00

I am trying to pass a string from one activity to another. I do

  • 0

I am trying to pass a string from one activity to another. I do not seem to be able to get the extra form the intent. Where am I going wrong?

Here is the code

To put the extra into the intent:

public void onClick(View v) {
    // TODO Auto-generated method stub
    String string = editTextFeild.getText().toString();
    Intent i = new Intent("com.com.com.otherclass");
    i.putExtra("dat", string);
    startActivity(new Intent("com.com.com.otherclass"));
}

To get the data from the intent (in the com.com.com.otherclass) :

Bundle bundle = getIntent().getExtras();
if (bundle != null){
    String string = bundle.getString("dat");
    textView.setText(string);
}

p.s. These are not the actual names I use in the code 🙂

Thanks in advance 🙂

  • 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-11T02:57:52+00:00Added an answer on June 11, 2026 at 2:57 am

    In your startActivity line, you’re creating a new Intent. Pass it ‘i’ instead.

    startActivity(i);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass data from one activity to another via Intent.putExtras like this:
I'm trying to pass a String array from one activity to another but when
I have been trying to pass a string value from one method into another.
1.I was trying to pass an array of string from 1 activity to another
I am trying to use inheritance to pass a string from one form to
I'm trying to pass a list from one form class to another. Here's the
I'm trying to pass in a string from one function to another to be
I get an error trying to send a string from one window to another
i'm trying to pass a string from main to another function. this string is
I am trying to get one string, two integers and one timepicker result from

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.