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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:11:26+00:00 2026-06-01T11:11:26+00:00

In my app I’m opening a connection to load data. In handset device (Galaxy

  • 0

In my app I’m opening a connection to load data. In handset device (Galaxy 2) and tablet p1000 (old 7" tablet with os 2.2) I have no problem and I can get and parse data.

But in another tablet (Samsung 7" plus – Honeycomb) the application crashes. Logcat says:

04-05 16:31:33.905: E/AndroidRuntime(4137): FATAL EXCEPTION: main
04-05 16:31:33.905: E/AndroidRuntime(4137): android.os.NetworkOnMainThreadException
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at java.net.InetAddress.lookupHostByName(InetAddress.java:477)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:277)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at java.net.InetAddress.getAllByName(InetAddress.java:249)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at cam.astro.mania.adapters.NewsAdapter.fetchImages(NewsAdapter.java:105)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at cam.astro.mania.adapters.NewsAdapter.setData(NewsAdapter.java:45)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.astro.mania.activities.NewsList.displayData(NewsList.java:359)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.astro.mania.activities.NewsList.access$4(NewsList.java:358)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.astro.mania.activities.NewsList$MyAsyncTask.onPostExecute(NewsList.java:199)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.astro.mania.activities.NewsList$MyAsyncTask.onPostExecute(NewsList.java:1)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.AsyncTask.finish(AsyncTask.java:590)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.AsyncTask.access$600(AsyncTask.java:149)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:603)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.os.Looper.loop(Looper.java:132)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at android.app.ActivityThread.main(ActivityThread.java:4123)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at java.lang.reflect.Method.invokeNative(Native Method)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at java.lang.reflect.Method.invoke(Method.java:491)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
04-05 16:31:33.905: E/AndroidRuntime(4137):     at dalvik.system.NativeStart.main(Native Method)

my code is:

/*-------------------------------
     * Downloading images from server
     * ------------------------------*/
    private Bitmap[] fetchImages(ArrayList<String> urlstr){
        InputStream is= null;
        Bitmap bm = null;
        Bitmap[] bmList = new Bitmap[urlstr.size()];
        
        try {
            for(int i=0; i<urlstr.size(); i++){
                HttpGet httpRequest = new HttpGet(urlstr.get(i));
                HttpClient httpclient = new DefaultHttpClient();
                HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
    
                HttpEntity entity = response.getEntity();
                BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
                is = bufHttpEntity.getContent();
                bm = BitmapFactory.decodeStream(is); 
                bmList[i] = bm;
            }
        }catch ( MalformedURLException e ){
            Log.d( "RemoteImageHandler", "fetchImage passed invalid URL: " + urlstr );
        }catch ( IOException e ){
            Log.d( "RemoteImageHandler", "fetchImage IO exception: " + e );
        }finally{
            if(is!=null)try{
                is.close();
            }catch(IOException e){}
        }
        
        return bmList;
    }

Logcat points to HttpResponse response = (HttpResponse) httpclient.execute(httpRequest). I don’t understand what is the meaning of error. What is 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-01T11:11:28+00:00Added an answer on June 1, 2026 at 11:11 am

    Start a new thread for you download and do it there. Inform your main thread via message to Handler or just wait for thread to finish using join()

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

Sidebar

Related Questions

My app allows users to have custom subdomains, as in user1.domain.com. I am integrating
App Engine Datastore cannot be queried for an aggregate result. Example: I have an
App Description: I have a UIWebview and a Toolbar beneath it. A button on
App runs on simulator on my MacBook Air, but not on iMac. I have
App Store We have been developing an app for quite some time now for
My app must report its job load via HTTP API. The play status command
My app will have no user interface at all (exept for notifications) except for
My app works fine in the simulator, and on other devices. I have an
My App needs to connect to and grab data from a MySQL database sitting
App reads JSON data. Then it would put it to whe listview (correctly) but

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.