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

The Archive Base Latest Questions

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

I’m not really sure what else I can do with this. Here’s a function

  • 0

I’m not really sure what else I can do with this. Here’s a function that refuses to print the stacktrace whatever I do. I’m not sure if it’s because Eclipse isnt’ deploying the right .apk to the emulator or if it’s something I’m doing. So:

private String getStringFromResponse(HttpResponse response) {
    try {
        InputStream in = response.getEntity().getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        StringBuilder str = new StringBuilder();
        String line = null;
        while((line = reader.readLine()) != null){
            str.append(line);
        }
        in.close();
        String responseXMLString = str.toString();
        return responseXMLString;
    }
    catch(Exception ex) {
        ex.printStackTrace();
        String stackTrace = ex.getStackTrace().toString();
        Log.i("PPKMCC-NtwrkAccessClass", stackTrace);
        return null;
    }
}

There is an exception at str.toString(). I don’t know the cause because I’m not able to view the stacktrace. I don’t think it’s because of the size of the response because the same code was downloading the prefs fine till now.

In the catch block, printStackTrace() doesn’t output to the Logcat. I have a break point at String stacktrace but it doesn’t hit that particular breakpoint and instead goes directly to return null. I’ve tried resetting the emulator, creating a completely new emulator instance, cleaning my project, none of them seem to work.

Any help is much appreciated!

Thanks,
Teja.

  • 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:52:57+00:00Added an answer on May 22, 2026 at 1:52 am

    Regarding the StackTrace,

    you can’t directly print the Stacktrace like in Java, you have to do a bit of gymnastic.
    you can try this:

    Log.e("jason", "Login exception triggered : "+ e.getMessage() +"\n"+e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream stream = new PrintStream( baos );
    e.printStackTrace(stream);
    stream.flush();
    Log.e("jason", new String( baos.toByteArray() ) );
    

    Regarding the breakpoint:

    I would suggest:

    1) check that the function is called

    2) check that you are launching in debug

    3) check that your manifest allows debug

    Regarding the str.toString(), I think it can only crash when called on a null object.
    I would suggest adding a

    `if(str != null)
    {
       //toString
    }else{
       Log.e(TAG,"str == null");
    }
    

    `

    Hope it helps

    Jason

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

Sidebar

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm looking for suggestions for debugging... If you view this site in Firefox or
I want use html5's new tag to play a wav file (currently only supported
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am currently running into a problem where an element is coming back from
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
In order to apply a triggered animation to all ToolTip s in my app,
I have a JSP page retrieving data and when single or double quotes are

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.