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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:14:44+00:00 2026-06-04T20:14:44+00:00

i got a little problem with downloading images from the web to my android

  • 0

i got a little problem with downloading images from the web to my android project. Everytime i try to connect to the internet my app just keeps crashing.
Yes i added the permission to the Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.my.app"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET"/>

The logCat says this:

06-02 12:15:36.520: E/AndroidRuntime(13947): FATAL EXCEPTION: main
06-02 12:15:36.520: E/AndroidRuntime(13947): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.my.app.MyAppActivity}: android.os.NetworkOnMainThreadException
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.os.Looper.loop(Looper.java:137)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread.main(ActivityThread.java:4424)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.lang.reflect.Method.invokeNative(Native Method)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.lang.reflect.Method.invoke(Method.java:511)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at dalvik.system.NativeStart.main(Native Method)
06-02 12:15:36.520: E/AndroidRuntime(13947): Caused by: android.os.NetworkOnMainThreadException
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.net.InetAddress.getAllByName(InetAddress.java:220)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.net.URLConnection.getContent(URLConnection.java:194)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at java.net.URL.getContent(URL.java:447)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at com.my.app.MyAppActivity.onCreate(MyAppActivity.java:25)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.Activity.performCreate(Activity.java:4465)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-02 12:15:36.520: E/AndroidRuntime(13947):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-02 12:15:36.520: E/AndroidRuntime(13947):    ... 11 more

Spent almost an hour now trying to figure out what’s the problem….

  • 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-04T20:14:46+00:00Added an answer on June 4, 2026 at 8:14 pm

    you have to use AsyncTask to download image from server because your main thread can’t handle it.And you are trying to download image in main thread.so NetworkOnMainThreadException occure.So download image in seperate thread.

    See this Example

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

Sidebar

Related Questions

I got a little problem. Sometimes, when I try to call the following code,
I've created a simple class and got a little problem: I just want to
I'm playing around with error handling and got a little problem. I connect with
I stumbled across a little problem with an ASP.NET Web Application. I got a
Got a little problem. I'd like to create an android list view activity with
I got a little problem. I got a map (on android phone) called Save,
I've got a little problem by subtracting two datetime objects from each other. I
I got a little problem with my SQLite database in my app. My goal
i`ve got a little problem with LINQ. I read out some information via XML-RPC.
I got a little problem, I got a code, that reads all pixels and

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.