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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:06:56+00:00 2026-05-22T01:06:56+00:00

Device is a Xoom Tablet. For some reason I can’t do a HttpPost, when

  • 0

Device is a Xoom Tablet. For some reason I can’t do a HttpPost, when I try I can’t trap the error. I tried a bunch of basic examples and they all crashed out the same way (see stack trace). I will attach my manifest in case I missed a permission. I know it’s happening in the client.execute(post); statement. The error is not trapped and all I get is what you see in the stack trace below. I have tried a bunch of different ways but I can’t for the life of me tell what the real error is. The post data does not seem to matter, same thing happens with a simple HttpGet request. What on earth am I missing?

Block in question

try {
                HttpClient client = new DefaultHttpClient();
                HttpPost post = new HttpPost("http://share1.iqperspective.com/test");
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                nameValuePairs.add(new BasicNameValuePair("avar", "test data"));
                post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                client.execute(post);

            }catch (UnsupportedEncodingException e1) {
                Log.v(TAG, "catch1");
            }catch (ClientProtocolException e) {
                Log.v(TAG, "catch2");
            }catch (IOException e) {
                Log.v(TAG, "catch3");
            }

Mainifest

<?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.quisenberry.iqperspective"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="11" />
<application android:icon="@drawable/img_icon" android:label="@string/app_name">
    <activity android:name="IQPerspective" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</manifest>

The Stack

Thread [<1> main] (Suspended (exception NetworkOnMainThreadException))  
DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) line: 530    
DefaultHttpClient(AbstractHttpClient).execute(HttpHost, HttpRequest, HttpContext) line: 555 
DefaultHttpClient(AbstractHttpClient).execute(HttpUriRequest, HttpContext) line: 487    
DefaultHttpClient(AbstractHttpClient).execute(HttpUriRequest) line: 465 
IQPerspective$13.onClick(View) line: 294    
Button(View).performClick() line: 3100  
View$PerformClick.run() line: 11644 
ViewRoot(Handler).handleCallback(Message) line: 587 
ViewRoot(Handler).dispatchMessage(Message) line: 92 
Looper.loop() line: 126 
ActivityThread.main(String[]) line: 3997    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 491  
ZygoteInit$MethodAndArgsCaller.run() line: 841  
ZygoteInit.main(String[]) line: 599 
NativeStart.main(String[]) line: not available [native method]  
  • 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-22T01:06:56+00:00Added an answer on May 22, 2026 at 1:06 am

    I think the name of the exception (NetworkOnMainThreadException) tells you what’s going on. You need to execute your networking code on a non-UI thread. See the article Painless Threading for more info.

    This is something new to Honeycomb. See the docs for the exception for more info.

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

Sidebar

Related Questions

On a rooted android device, I tried to run a cat command that read
I have a Device interface: public interface IDevice { double Measure(); } Some classes
is there a unique device ID that I can use in Flash Builder/AS3 to
In my Android application running in a XOOM device, when I click in an
Details: Device (Xoom, latest OS) with Air (latest prerelease), JPG is a 8bit RGB.
My device always gives me location updates wrongly first time and after some time
Lets assume a device that can give n signals at random times. We collect
I'm working on a Honeycomb tablet app that needs to scale some UI views
I am testing on a Xoom device, running OS 3.2. The project is built
A device contains an array of locations, some of which contain values that we

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.