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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:47:45+00:00 2026-05-25T23:47:45+00:00

I have this simple code, that makes a get to a webservice. For some

  • 0

I have this simple code, that makes a get to a webservice.
For some reason it cant connect and gives the error in the log unknownHostException

This is the code:

String URL = "http://services.sapo.pt/EPG/GetChannelList";
String result = "";
final String tag = "Data received: ";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final Button btnSearch = (Button)findViewById(R.id.btnSearch);
    btnSearch.setOnClickListener(new Button.OnClickListener(){
        public void onClick(View v) {
            callWebService();
        }
    });

} // end onCreate()

public void callWebService(){
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet request = new HttpGet(URL);
    ResponseHandler<String> handler = new BasicResponseHandler();

    try {
        result = httpclient.execute(request, handler);
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    httpclient.getConnectionManager().shutdown();
    Log.i(tag, result);
}

This is part of my manifest

<permission android:name="android.permission.INTERNET"/>

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".AndroidApp"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
  • 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-25T23:47:45+00:00Added an answer on May 25, 2026 at 11:47 pm

    I found the solution.
    I putted the internet permission using the GUI in manifest which added the tag

    < permission android:name”android.permission.INTERNET”/>

    Then by hand, i putted the correct tag that is:

    < uses-permission android:name=”android.permission.INTERNET” />

    which is a different tag and it worked. GUI fail.

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

Sidebar

Related Questions

This makes no sense. I have some code that has a simple LinearLayout and
I have this simple code that speaks for itself. <script language='javascript"> function check() {}
I am a total beginner in JS/XML. I have this simple code that needs
I have some code I've written in PHP for consuming our simple webservice, which
I have an app that makes intensively uses of Wininet functions to get some
I have some simple code that is comparing two float values to illustrate a
I have a data that looks like this . And my code below simply
I've wrote this simple piece of code. And I have a slight problem with
There is probably is simple fix for this but I currently have code similar
I have this simple regex, [\d]{1,5} that matches any integer between 0 and 99999.

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.