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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:30:54+00:00 2026-05-22T16:30:54+00:00

So Im trying to create a url to use httpget on, to download the

  • 0

So Im trying to create a url to use httpget on, to download the page source.
But Im having problems every time I run the app it says i have an illegal character in the string/uri.
Here’s the code Ive tried.

String Search = "http://www.lala.com/";

also,

HttpGet request = new HttpGet("http://www.lala.com/");

and every time i try,

Uri search = new Uri("http://www.lala.com/");

I get “Cannot instantiate Uri”.

Im not really sure what im doing wrong, also this is the code to get the page source.

try
          {
            HttpClient client = new DefaultHttpClient();
            HttpGet request = new HttpGet("http://www.lala.com/");
            HttpResponse response = client.execute(request);


            InputStream in = response.getEntity().getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
            StringBuilder str = new StringBuilder();
            String line = null;
            while((line = reader.readLine()) != null)
            {
                str.append(line);
            }
            in.close();
            html = str.toString();   
           }
           catch (IOException e1)
           {

           }

Thanks for the help! ~ Tanner.

(lala.com is not the site I am using btw 😛 )

  • 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-05-22T16:30:54+00:00Added an answer on May 22, 2026 at 4:30 pm

    That is because Uri is an abstract class and can’t be instantiated. Use this instead:

    Uri search = Uri.parse("http://www.lala.com/");
    

    If using HttpGet you will need to use the class java.net.URI instead of the android Uri. A quick example:

    try {
            URI search = new URI("http://www.lala.com/");
            new HttpGet(search);
        } catch (URISyntaxException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this script (which extracts the domain from a URL): CREATE
I am trying to create a page for just personal use. What I want
I'm trying to connect to an HTTPS URL, but I need to use client
I'm trying to create a url handler and I tried to use preg_match for
I am trying to create a page which has Telerik Editor control. Use can
I'm basically trying to create a url friendly query string with user input. The
So i'm trying to POST something to a webserver. System.Net.HttpWebRequest EventReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url); System.String
Im trying to create a web service which gets to a URL e.g. www.domain.co.uk/prices.csv
I'm trying to create permanent redirects for outdated URL's on my site. For example
I'm trying to create a dynamic regex to select URL's based on a segment

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.