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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:06:10+00:00 2026-06-01T19:06:10+00:00

I have an HTTP GET that is receiving information from a URI. The URI

  • 0

I have an HTTP GET that is receiving information from a URI. The URI is for Google Shopping.

https://www.googleapis.com/shopping/search/v1/public/products?key=key&country=US&q=digital+camera&alt=atom

(Left my key out).

Is there a way that I can change it from

q=digital+camera

to anything a user puts in an EditText?

So basically, I want the EditText to change what is searched on Google Shopping.

First screen, ProductSearchEntry with EditText for search query:

enter image description here

Code for ProductSearchEntry

public class ProductSearchEntry extends Activity{
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.productsearchentry);

    Button search = (Button) findViewById(R.id.searchButton);

    search.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent searchIntent = new Intent(getApplicationContext(), ProductSearch.class);
                startActivity(searchIntent);
        }
    });
    }
}

Then, I have a second class, ProductSearch, with no picture, but just this code:

public class ProductSearch extends Activity{
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.productsearchresults);
     EditText searchQuery = (EditText) findViewById(R.id.searchQuery);

        ProductSearchMethod test = new ProductSearchMethod();
        String entry;
        TextView httpStuff = (TextView) findViewById(R.id.httpTextView);
        try {
            entry = test.getSearchData(searchQuery.getText().toString());
            httpStuff.setText(entry);
              } catch (Exception e) {
                        e.printStackTrace();
    }
}
}

Which references the ProductSearchMethod class which consists of a TextView that is changed to the code recieved in the HTTP GET:

enter image description here

Code:

public class ProductSearchMethod {

public String getSearchData(String query) throws Exception{
    BufferedReader in = null;
    String data = null;
    try{
        HttpClient client = new DefaultHttpClient();
        URI site = new URI("https://www.googleapis.com/shopping/search/v1/public/products?key=key&country=US&q="+query.replace(" ","+")+"&alt=atom");
     HttpGet request = new HttpGet();
    request.setURI(site);
    HttpResponse response = client.execute(request);
    in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    StringBuffer sb = new StringBuffer("");
    String l = "";
    String nl = System.getProperty("line.seperator");
    while((l = in.readLine()) !=null){
        sb.append(l + nl);
    }
    in.close();
    data = sb.toString();
    return data;
    }finally{
        if (in != null){
            try{
                in.close();
                return data;
            }catch (Exception e){
                e.printStackTrace();
                }
            }
        } 
    }
}

ProductSearchMethod comes up great, but it doesn’t change the text from “Loading Items” to the website code. I had it working before but then I tried to edit what it searched (all this ^) and now it doesn’t change.

  • 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-01T19:06:12+00:00Added an answer on June 1, 2026 at 7:06 pm

    Make changes in your code like

    public class ProductSearchEntry extends Activity{ 
    protected void onCreate(Bundle savedInstanceState){ 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.productsearchentry); 
        EditText etSearch = (EditText) findViewById(id of your edittext);
        Button search = (Button) findViewById(R.id.searchButton); 
    
        search.setOnClickListener(new View.OnClickListener() { 
    
            @Override 
            public void onClick(View v) { 
                //while calling intent 
    
                Intent searchIntent = new Intent(getApplicationContext(), ProductSearch.class); 
                searchIntent.putExtra("searchText",etSearch.getText().toString());
                startActivity(searchIntent); 
            } 
        }); 
        } 
    } 
    

    and another activity like this,

    public class ProductSearch extends Activity{     
    protected void onCreate(Bundle savedInstanceState){     
        super.onCreate(savedInstanceState);     
        setContentView(R.layout.productsearchresults);     
            String searchQuery = getIntent().getStringExtra("searchText");     
            ProductSearchMethod test = new ProductSearchMethod();     
            String entry;     
            TextView httpStuff = (TextView) findViewById(R.id.httpTextView);     
            try {     
                entry = test.getSearchData(searchQuery);     
                httpStuff.setText(entry);     
                  } catch (Exception e) {     
                            e.printStackTrace();     
        }     
    }     
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple test application (C# console application) that does an HTTP GET
If i have a Controller Action that may recieve both HTTP GET and HTTP
I have this code require 'mechanize' @agent = Mechanize.new page = @agent.get('http://something.com/?page=1') next_page =
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/
I have a sortable list like this one: http://jqueryui.com/demos/sortable Is it possible to get
I have a web application which uses URLs that look like this: http://library.example.com/Register.aspx?query=academic&key=586c70bb-5683-419c-aae9-e596af9ab66a (The
I have a question about JSF and GET http request. How can I get
I have the following case where I get the result of UTF-8 encoded HTTP
I have URL like this: http://localhost/PMApp/temp.htm?ProjectID=462 What I need to do is to get
I have this string: small: http://img.exent.com/free/frg/products/666550/player_boxshot.jpg boxshot: http://img.exent.com/free/frg/products/666550/boxshot.jpg I want to get only the

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.