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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:36:21+00:00 2026-05-26T07:36:21+00:00

Hey I’m having a big issue with my android App. I’m currently updating it

  • 0

Hey I’m having a big issue with my android App. I’m currently updating it and I switched from API 8 to API 10 and the following block of code doesn’t work anymore …

URL url = new URL(PingUrl);
URLConnection Conn = url.openConnection();
Conn.setConnectTimeout(4000);
int Size = 2048;
BufferedReader input = new BufferedReader(new InputStreamReader(Conn.getInputStream()), Size);
String line = null;
while ((line = input.readLine()) != null) {
    JSONObject jo = new JSONObject(line);
    String timeStamp = jo.getString("timestamp");
    //Log.i("Value",timeStamp);
}
input.close();
result = true;

It crashes @ BufferedReader … anyone got an idea ?

10-19 16:46:04.814: ERROR/AndroidRuntime(2151): FATAL EXCEPTION: main
10-19 16:46:04.814: ERROR/AndroidRuntime(2151): java.lang.RuntimeException: Unable to start activity ComponentInfo{be.paratel.PAC/be.paratel.PAC.PACMainViewActivity}: android.os.NetworkOnMainThreadException
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread.access$500(ActivityThread.java:122)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)

10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.os.Looper.loop(Looper.java:132)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread.main(ActivityThread.java:4123)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at java.lang.reflect.Method.invokeNative(Native Method)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at java.lang.reflect.Method.invoke(Method.java:491)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at dalvik.system.NativeStart.main(Native Method)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151): Caused by: android.os.NetworkOnMainThreadException
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at java.net.InetAddress.lookupHostByName(InetAddress.java:477)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:277)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at java.net.InetAddress.getAllByName(InetAddress.java:249)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:304)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:292)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:274)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1038)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:523)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at be.paratel.PAC.PACMainViewActivity.pingTheApplication(PACMainViewActivity.java:245)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at be.paratel.PAC.PACMainViewActivity.ConnectionCheck(PACMainViewActivity.java:296)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at be.paratel.PAC.PACMainViewActivity.onCreate(PACMainViewActivity.java:70)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.Activity.performCreate(Activity.java:4397)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
10-19 16:46:04.814: ERROR/AndroidRuntime(2151):     ... 11 more
  • 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-26T07:36:21+00:00Added an answer on May 26, 2026 at 7:36 am

    I never faced that problem but I think the stacktrace is telling you what is wrong: NetworkOnMainThreadException

    Seems like android OS is forbidding a synchronous HTTP request on the main thread, because this will block the UI. So it seems to prevent you from making bad decisions (good idea I think). You should use an AsyncTask for network requests anyway.

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

Sidebar

Related Questions

Hey I am getting index out of bounds error in my code. From Activity:
Hey guys I'm running this code in Android: public ServiceServer(String serverName) { this.serverName =
Hey, I'm trying to get the source code of an app similar to the
Hey, in the Programming Pearls book, there is a source code for setting, clearing
Hey having some trouble trying to maintain transparency on a png when i create
Hey I'm building an app that will allow a user to log into a
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey all I want to reseed my IDENTITY COLUMN values starting from 1 I
Hey, I have a question regarding code structure, and was wondering what the best
Hey guys I'm following the rails tutorial found here http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ and I've gotten to

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.