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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:39:02+00:00 2026-06-15T18:39:02+00:00

try { String URLName = http://www.sample.com; String line,res = ; HttpURLConnection con = (HttpURLConnection)

  • 0
try {
       String URLName = "http://www.sample.com";
       String line,res = "";
       HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection();
       BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
       while ((line = in.readLine()) != null){
          res=res+line;
       }

}
catch (Exception e) {
      e.printStackTrace();
}

by the end, I get “” from res on my friend’s android 4.x
but it runs fine on my emulator
and when I use the browser on my friend’s phone to open the site: http://www.sample.com
then my app works again until we restart the phone

  • 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-15T18:39:03+00:00Added an answer on June 15, 2026 at 6:39 pm

    If it runs fine on your emulator(I assume the emulator runs on API Level 11<), but not on Android 4.x then I assume you are performing an heavy network task in your UI thread. Use an Asynctask to avoid that.

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

Sidebar

Related Questions

I try to get string from this url: http://autoc.finance.yahoo.com/autoc?query=google&callback=YAHOO.Finance.SymbolSuggest.ssCallback When I look at this
I am trying this code in java: try { String url = http://url.com/file.ext; InputStream
I am using google-api-translate-java-0.92.jar. Translate.setHttpReferrer( http://translate.google.com/ ); try { String translation = Translate.execute(arrangement, Language.ENGLISH,
try { String endPointAddr = net.tcp://localhost:8000/MyService; NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.TransactionFlow = false;
public bool send() { try { string body = _omschrijving; var fromAddress = new
This is a refactoring question. try { string line = GetFirstLineFromFile(); //Gets first line
try { string filename = E:\\sox-14-4-0\\mysamplevoice.wav; Process p = new Process(); p.StartInfo.UseShellExecute = false;
public static void getClientUpdate() { try { String inputLine; double version = 0; URL
try { String s1 = example@gmail.com; //sender (from) String s2 = request.getParameter(email);// (from jsp
Here's a pseudo-code: try { TextReader tr = new StreamReader(filename); try { string content

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.