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.
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:
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
`
Hope it helps
Jason