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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:18:54+00:00 2026-06-15T04:18:54+00:00

I require a GET reequest from my own server to be extracted from the

  • 0

I require a GET reequest from my own server to be extracted from the web and then displayed on screen with a TextView.

I have set up a GET Request.

public class GetMethodEx {


public String getInternetData() throws Exception{
        BufferedReader in = null;
        String data = null;
        try
        {
            HttpClient client = new DefaultHttpClient();
            URI website = new URI("http://www.mybringback.com");
            HttpGet request = new HttpGet();
            request.setURI(website);
            HttpResponse response = client.execute(request);
            in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
            StringBuffer sb = new StringBuffer("");
            String l = "";
            String nl = System.getProperty("line.separator");
            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();
                }
            }
        }
}

}

And I have set up on my main thread to extract the information and display it in a text view.

public class Home extends Activity {

    TextView httpStuff;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.httpexample);
        httpStuff = (TextView) findViewById(R.id.tvhttp);
        GetMethodEx test = new GetMethodEx();
        String returned;
        try {
            returned = test.getInternetData();
            httpStuff.setText(returned);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

However, the Textview doesnt seem to change?

Can someone help me please.

  • 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-15T04:18:56+00:00Added an answer on June 15, 2026 at 4:18 am

    Change your code using AsyncTask if you want to make any network operation from Ui Thread as:

    public class Home extends Activity {
    
        TextView httpStuff;
    
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.httpexample);
            httpStuff = (TextView) findViewById(R.id.tvhttp);
           new LongOperation().execute("");
        }
    private class LongOperation extends AsyncTask<String, Void, String> {
    
          @Override
          protected String doInBackground(String... params) {
            GetMethodEx test = new GetMethodEx();
            String returned;
            try {
                returned = test.getInternetData();
    
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
                return returned;
          }      
    
          @Override
          protected void onPostExecute(String result) {    
            // Update Ui here    
             httpStuff.setText(result);       
          }
    
    }
    

    }

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

Sidebar

Related Questions

I have simple Sinatra app. web.rb: require 'sinatra' get '/' do Hello end Gemfile:*
I'm trying to get require.js to load modules on the server-side with Java 6
I have this in hi.rb require 'rubygems' require 'sinatra' get '/hi' do Hello World!
I have this code require 'mechanize' @agent = Mechanize.new page = @agent.get('http://something.com/?page=1') next_page =
i have a problem when try to get and parse a remote JSON. require
This view function: @login_required def dashboard(request): from myproject.myapp.models import UserProfile k = UserProfile.objects.get( user=request.user.pk
I am trying to get a request token from twitter, and I've been having
I have a web site which I download 2-3 MB of raw data from
require 'sinatra/base' class Foo < Sinatra::Base get('/foo') { 'foo' } end class Bar <
Am using require.js to load backbone, and my other scripts, but i get an

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.