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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:42:39+00:00 2026-06-03T08:42:39+00:00

How can I use Integers and Strings from ione Activity in an other? Thanks

  • 0

How can I use Integers and Strings from ione Activity in an other?

Thanks

  • 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-03T08:42:40+00:00Added an answer on June 3, 2026 at 8:42 am

    In Activity 1:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search);
    
        Button search = (Button) findViewById(R.id.btnSearch);
        search.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
    
                Intent intent = new Intent(Search.this, SearchResults.class);  
                Bundle b = new Bundle(); 
    
                EditText txt1 = (EditText) findViewById(R.id.edittext);
                EditText txt2 = (EditText) findViewById(R.id.edittext2);
    
                b.putString("name", txt1.getText().toString());
                b.putInt("state", Integer.parseInt(txt2.getText().toString()));  
    
                //Add the set of extended data to the intent and start it
                intent.putExtras(b);
                startActivity(intent);  
            }
    
        });
    }
    

    In the receiving Activity:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search_results);
    
        Bundle b = getIntent().getExtras(); 
        int value = b.getInt("state", 0);
        String name = b.getString("name");
    
        TextView vw1 = (TextView) findViewById(R.id.txtName);
        TextView vw2 = (TextView) findViewById(R.id.txtState);
    
        vw1.setText("Name: " + name);
        vw2.setText("State: " + String.valueOf(value));
    }
    

    But next Time search on SO before posting such a basic question. There are a lot of similar Questions out there.

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

Sidebar

Related Questions

Since enumeration uses integers, what other structure can I use to give me enum-like
I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
Possible Duplicate: How do I compare strings in Java? Why can't my program use
I know that for an integer, you can use: int value; I tried: string
How can I use a batch file to loop through non-integer values? I'm trying
I can use the following to get the contents of a folder with no
Users can use their Google, Facebook or Twitter account to login to a site
I can use .button() to create beautiful submit buttons, but the rest of the
I can use FireFox and FireBug, in a pane, I can open a .css
I can use the PRINT statement in a stored procedure to debug my code.

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.