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

The Archive Base Latest Questions

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

First off, let me explain that I am well aware of what this exception

  • 0

First off, let me explain that I am well aware of what this exception means, please read the question thoroughly if you’re going to answer.

I know that the exception arises when you try to do UI work on a network thread. I am using AsyncTask but I’m doing any UI operations.

Here is the snippet from AsyncTask code where the error is being thrown
NOTE aps and adm are declared ahead of time
Its in the Extracter initialization that the exception is being thrown:

    do{
            try{

                HttpPost request = new HttpPost(params[0]);
                request.setHeader("Accept", "application/json");
                request.setHeader("Content-type", "application/json");
                aps.setLastSent(lastSent);
                StringEntity filterEntity = new StringEntity(aps.TempParameter()); //Remember this TempParameter is temporary function
                request.setEntity(filterEntity);
                response = httpClient.execute(request);
                StatusLine statusLine = response.getStatusLine();
                if(statusLine.getStatusCode() == HttpStatus.SC_OK){
                    Extracter extracter = new Extracter(response);
                    lastSent = extracter.extractLastSent();
                    adm.addDictionary(extracter.extractDictionary());
                }
            } catch (ClientProtocolException e) {
                //TODO Handle problems..
                builder.append("Client protocol exception");
            } catch (IOException e) {
                //TODO Handle problems..
                builder.append(e.toString());
            }
        }while(lastSent != "done");

            return adm.getAlarmObjectList();

The line

    Extracter extracter = new Extracter(response);

is where the exception is thrown.
Here is the code for the Extracter class:

    public class Extracter extends AlarmLoopTestActivity {



private JSONObject jo;
private JSONArray ja;

public Extracter(HttpResponse response){
    StringBuilder builder = new StringBuilder();
    HttpEntity entity = response.getEntity();
    try {
        InputStream content = entity.getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(content));
        String line;
        while((line = reader.readLine())!= null){
            builder.append(line);
        }
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    String json = builder.toString();
    try {
        jo = (JSONObject) new JSONTokener(json).nextValue();
        ja = jo.getJSONArray("effectNamesDict");
    } catch (JSONException e) {
        jo = null;
        e.printStackTrace();
    }

}

I’m assuming printingStackTrace is not considered a UI event. Other then that, I’m at a loss. I need to get new eyes on this. Let me know if I need to elaborate anything further.

  • 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-04T04:44:46+00:00Added an answer on June 4, 2026 at 4:44 am

    Your Extracter is extending a class AlarmLoopTestActivity going from the name this is an android Activity and so it probably has some UI interaction methods in there!

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

Sidebar

Related Questions

First off, let me preface this question by saying that my professor is firmly
First off, let me preface this question by stating that I'm really a pretty
First off, let me start by saying, I know this exact question has been
First off, let me start by saying that I am totally new to working
First off, let me apologize if this has been asked already, but I can’t
let me first off noting that I have absolutely no idea what I'm doing
First, let me explain what I am doing. I have a CVS repository that
First off, let me apologize if I'm writing this in the wrong place. I
First off, I don't know if this is possible, but let me describe my
First off, I read all of the suggested questions that sounded halfway relevant 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.