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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:15:13+00:00 2026-06-13T23:15:13+00:00

I am calling the 2nd Activity from 1st: Intent intent = new Intent(); intent.setClass(MainActivity.this,

  • 0

I am calling the 2nd Activity from 1st:

Intent intent = new Intent();
intent.setClass(MainActivity.this,  SecondActivity.class);
Bundle b = new Bundle();
b.putInt(SecondActivity.ID,id);
System.out.println("id*"+id);
b.putString(SecondActivity.NAME, name);
System.out.println("name*"+name);
intent.putExtras(b);
startActivity(intent);

LogCat:

11-06 19:33:57.451: I/System.out(7987): id*2
11-06 19:33:57.451: I/System.out(7987): name*MrBlack

2nd Activity:

public static final String ID = "";
public static final String NAME = "";
................
Bundle extras = getIntent().getExtras();
int id = extras.getInt(ID);

System.out.println("extras.getInt(ID)*"+extras.getInt(ID));
System.out.println("extras.getString(ID)*"+extras.getString(ID));
System.out.println("extras.getString(NAME)*"+extras.getString(NAME));
TextView tvFirmaName = (TextView) findViewById(R.id.tvName);
tvFirmaName.setText(extras.getString(NAME));

LogCat:

11-06 19:33:57.721: I/System.out(7987): extras.getInt(ID)*0
11-06 19:33:57.731: I/System.out(7987): extras.getString(ID)*MrBlack
11-06 19:33:57.731: I/System.out(7987): extras.getString(NAME)*MrBlack

I do not understand why int value 2 is passing as 0
And why extras.getString(ID) is “MrBlack” value!?

Please, let me know where I was wrong..

  • 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-13T23:15:14+00:00Added an answer on June 13, 2026 at 11:15 pm
    public static final String ID = "";
    public static final String NAME = "";
    

    You need to provide values for those strings, they act as variable names for the info you’re passing. Their values are arbitrary, so long as they’re not equal to one another.

    Cheers

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

Sidebar

Related Questions

Possible Duplicate: C++ virtual function from constructor Calling virtual functions inside constructors This question
I am calling a scraping class from Flask and the second time I instantiate
This is a follow-up from this question : Effective Java 2nd Edition, Item 17:
I'm new to this as I come from C++ and Perl background. Trying to
UPDATE: It looks like my 13.0.1 is calling code from this diffed CharMatcher. http://code.google.com/p/guava-libraries/source/diff?spec=svn69ad96b719d7cd3d872a948d7454f17b816a21c2&r=464b0cfab7c3b6713c35e6f3ae7426542668c77b&format=side&path=/guava/src/com/google/common/base/CharMatcher.java
Calling the WriteObject Method from a background thread is not possible! Is there a
Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
//calling class import javax.swing.JFrame; class jcheckkbox { public static void main(String args[]) { jRadio
Calling getActionBar returns null . This has been frequently reported so I've made sure
Calling urrlib2.urlopen on a link to an article fetched from an RSS feed leads

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.