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

  • Home
  • SEARCH
  • 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 7665105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:28:35+00:00 2026-05-31T14:28:35+00:00

I try to get text from website that I show in a textview. I

  • 0

I try to get text from website that I show in a textview.

I Use:

try {
         textUrl = new URL("http://google.com");
         BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
         String StringBuffer;
               String stringText = "";
         while ((StringBuffer = bufferReader.readLine()) != null) {
          stringText += StringBuffer;
         }
               bufferReader.close();

        } catch (MalformedURLException e) {

         e.printStackTrace();

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

        }

if I set <uses-sdk android:targetSdkVersion> to 15 (ICS 4.0.3) then my app crashes.
if I delete that line ( means that target is 1.6 I guess) then it works fine but my app is scales weird on my phone.

Logcat just tells me that it cannot start Activity.

//Pew Labs

LOG:

03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:703)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.widget.TabHost.setCurrentTab(TabHost.java:350)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:154)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:540)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.view.View.performClick(View.java:3549)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.view.View$PerformClick.run(View.java:14400)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.os.Handler.handleCallback(Handler.java:605)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.os.Looper.loop(Looper.java:154)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.app.ActivityThread.main(ActivityThread.java:4944)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at java.lang.reflect.Method.invokeNative(Native Method)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at java.lang.reflect.Method.invoke(Method.java:511)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at dalvik.system.NativeStart.main(Native Method)
03-21 17:12:42.874: E/AndroidRuntime(2101): Caused by: android.os.NetworkOnMainThreadException
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1178)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at java.net.InetAddress.lookupHostByName(InetAddress.java:394)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:245)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at java.net.InetAddress.getAllByName(InetAddress.java:220)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at com.pewlabs.sunds.Food.downloadFile(Food.java:64)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at com.pewlabs.sunds.Food.onCreate(Food.java:45)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.app.Activity.performCreate(Activity.java:4524)
03-21 17:12:42.874: E/AndroidRuntime(2101):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
  • 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-31T14:28:36+00:00Added an answer on May 31, 2026 at 2:28 pm

    The NetworkOnMainThreadException that was thrown is trying to tell you that you are doing network operations on the main UI Thread. You need to be doing them in a separate Thread, or a simple convention is to use a AsyncTask or Loader.

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

Sidebar

Related Questions

I try to get to a page straight from Bash at http://www.ocwconsortium.org/ . The
I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304
I want to use java to retrieve text from a website. I can easily
I'm currently working on a website that you'll find here: http://steadfastdesignfirm.com/rgw/ . I used
I have a link from that link: http://api.maxxiscentral.com/maxxiscentral/GetTyrePatterns from this link i want to
Some websites now use a JavaScript service from Tynt that appends text to copied
Is there a way to extract the text from a website (That only has
For my website I use the PHP API for Flickr ( http://www.flickr.com/services/api/ ). This
Using following code I try to get updated list of checkbuttons' corresponding text values,
I try get a my attribute inside Fancybox, and I get when I use

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.