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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:58:24+00:00 2026-06-10T14:58:24+00:00

I have an android app that the user can update by pressing an UPDATE

  • 0

I have an android app that the user can update by pressing an “UPDATE” button. This works perfect on wifi. However, on mobile data, it has a problem. The UPDATE process connects to my REST server and actually connects to 3 URLs for different data. On mobile data, the first and last URLs work fine, but the second one returns blank data. Like I said, on WIFI, all 3 URLs work perfect, but on 3G, they do not. It is always only the 2nd URL that is causing issues.

Here is my code. It is pretty standard:

//FIRST
URL url = new URL(Constants.firstURL); 
String line = null; 
InputStream is = (InputStream) url.getContent(); 
StringBuilder sb = new StringBuilder(); 
BufferedReader reader = new BufferedReader(new InputStreamReader(is)); 
while((line = reader.readLine()) != null)
{ 
    sb.append(line); 
} 
firstRawData = sb.toString().replace(" ", "").replace("\n", ""); 
is.close(); 

//SECOND
url = new URL(Constants.secondURL); 
line = null; 
is = (InputStream) url.getContent(); 
sb = new StringBuilder(); 
reader = new BufferedReader(new InputStreamReader(is)); 
while((line = reader.readLine()) != null)
{ 
    sb.append(line); 
} 
secondRawData = sb.toString().replace(" ", "").replace("\n", ""); 
is.close();

//THIRD
url = new URL(Constants.thirdURL); 
line = null; 
is = (InputStream) url.getContent(); 
sb = new StringBuilder(); 
reader = new BufferedReader(new InputStreamReader(is)); 
while((line = reader.readLine()) != null)
{ 
    sb.append(line); 
} 
thirdRawData = sb.toString().replace(" ", "").replace("\n", ""); 
is.close();

I would appreciate any help with this as I have never encountered this issue before.

Thank you.

EDIT: There are no errors anywhere that I can see and I have the URL stuff in a try/catch which catch MalformedURLException, IOException, NullPointerException and no exceptions are thrown. Logcat doesnt tell me anything either.

  • 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-10T14:58:26+00:00Added an answer on June 10, 2026 at 2:58 pm

    OK so I answered this myself after a while but forgot to reply.

    The problem was the fact that I was calling this method from within a thread. The thread was going off to work, while the rest of the code was moving forward. By the time it moved forward, the 2nd URL just simply hadn’t finished.

    When I moved the call outside the thread and made it run sequentially, then everything was fine!

    I was thinking I had to run any internet retrieval stuff in a thread but I think these calls are already in threads so it wasnt needed.

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

Sidebar

Related Questions

Lets say you have a web app related Android app that requires the user
I have a dialog in an Android app that I don't want the user
I have Android client app that communicates with server using Socket . On my
I have an android app that I am trying to launch and it gives
I have an Android app that has an Application class and I have another
I have an android app that plays audio from the application class. I have
I have an Android app that I had working a few months ago which
I have an Android app that begins by displaying a dialog. When I set
I started developing an android app that have to interact with MMS attachements, in
I have a 2.3.3 android app that I am developing that I would like

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.