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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:28:25+00:00 2026-06-13T17:28:25+00:00

Hi all I have sample applications which works on other platforms (from 1.6+) But

  • 0

Hi all I have sample applications which works on other platforms (from 1.6+) But same application is not working on my new Android 4.1 simulator. Problem is regarding HttpConnection. Means suppose I want to do login then I am not able to do that. There is no problem in code, because it works fine on all other AVD(1.6,2.1,2.2).

I also tried with simple httpconnection code but still that is not working.

There is any special setting requires to run internet on simulator for 4.1. But on my previous platforms I had not done any setting.

My HttpConnection code is as:

public String httpGetResponse(String url) {
    connectionUrl = url;
    query_string="";
    String response = null;
    try {
        int loc = url.indexOf('?');
        if(loc>-1){
            try {
                query_string=url.substring(loc);
            } catch (Exception e) {
                query_string="";
            }
        }
        processGetRequest();
        HttpResponse httpresponse = httpclient.execute(host, get);
        response = EntityUtils.toString(httpresponse.getEntity());
    } catch (Exception e) {
        response = null;
    }
    return response;
}

I am calling this method as:

response = connectionUtil.httpGetResponse("My URL");

On all other platforms I got response as String , But with 4.1 I am getting response as:

response:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org          /TR/html4/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type"    CONTENT="text/html; charset=iso-    8859-1"><TITLE>ERROR: The requested URL could not be retrieved</TITLE>

……….

Any suggestion will be appreciated 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-13T17:28:26+00:00Added an answer on June 13, 2026 at 5:28 pm

    There are two Solution of this Problem.

    1) Don’t write network call in Main UI Thread, Use Async Task for that.

    2) Write below code into your MainActivity file after setContentView(R.layout.activity_main);

    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }
    

    And below import statement into your java file.

    import android.os.StrictMode;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have working in large application which contain c and cpp. The all files
I have this scala application which is very simple . All that it does
I have to create a mobile application which will work on diffrent mobile platforms:
I have a simple WPF application I'm working on, which performs a SQL query
I have a small problem, looked here & other forums, but could not find
enter code here Hi All, I have a simple windows service application that connects
I have a simple button (3 of them - all same except the content
I have a simple table view which is editable. All I need the user
Scenario: I have an application (C#) that expects a SQL database and login, which
I Have a ResourceDictionary Generic.xaml which consists of a set of other resource dictionaries,

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.