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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:47:10+00:00 2026-06-05T17:47:10+00:00

I am trying to parse a website that searches by content1 or content2 depending

  • 0

I am trying to parse a website that searches by content1 or content2 depending which button is clicked. I have an algorithm that works fine, but I was asked to make it in two classes. I hope it’s not gonna make me change my whole algorithm. But yet, I am troubling sending string parameters to the new activity and I hated it.

I defined global parameters:

String content1;
String content2;

I need to get string in an EditText whose names are “namesurname” and “district”:

content1 = district.getText().toString();
content2 = namesurname.getText().toString();

I have two buttons that have listeners:

    search1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent search = new Intent(FirstActivity.this, SecondActivity.class);
            search.putExtra("param_a", content1);
                    startActivity(search);
        }               
    });
    search2.setOnClickListener(new View.OnClickListener() {         
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent search = new Intent(AvukatParserActivity.this, ParserActivity.class);
            search.putExtra("param_b", content2);
        startActivity(search);
        }
    });

From now on, my SecondActivity.class shows up.

I am trying to get intent in the new activity:

    Intent search = getIntent();
    String location = search.getStringExtra("param_a");
    String name_surname = search.getStringExtra("param_b");

Here’s how I check my content1:

Toast.makeText(this, location, Toast.LENGTH_LONG).show();

It toastes as null as content2. No errors, no warnings. I don’t get what I’m doing incorrect. 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-05T17:47:11+00:00Added an answer on June 5, 2026 at 5:47 pm
    1. each of the listeners put only a single value into the intent instead of both , and the toast shows only one of them .

    2. about this code:

      content1 = district.getText().toString();
      content2 = namesurname.getText().toString();
      

      put it inside the onClick methods , and then tell us if it helped .
      i’m guessing you put the old values there , so it gets null instead of the updated values.

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

Sidebar

Related Questions

I'm trying to make test-program that opens a website by pushing a button. I
I'm trying to parse some data out of a website. The problem is that
So I am trying to develop a program that will parse a website for
I am trying to use Hpricot to parse amazon mobile.website but I found that
I am trying to parse one element from a website that is inside of
I'm trying to parse a title from the following piece of html: Website (Newton)
I'm trying to use JSoup in my android app to parse a certain website.
Trying to parse Maplines for an airport. Each airport can have X number of
I am trying to parse a website. I am using the HTMLParser module. The
I'm trying to parse a URI that has brackets - [ and ] -

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.