I do requests to my servlet
try {
Log.d(Constants.DEBUG_TAG_MAPS, "try");
HttpEntity entity = new StringEntity(json);
post.setEntity(entity);
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);
HttpConnectionParams.setSoTimeout(httpParameters, 150000);
httpclient = new DefaultHttpClient(httpParameters);
BasicHttpResponse response = (BasicHttpResponse ) httpclient.execute(post);
Log.d(Constants.DEBUG_TAG_MAPS, "http status code : "+response.getStatusLine().getStatusCode());
if(response.getStatusLine().getStatusCode() == 200){
Log.d(Constants.DEBUG_TAG_MAPS, "response 200");
HttpEntity responseEntity = response.getEntity();
if (responseEntity!= null) {
Gson g = new Gson();
InputStream is = responseEntity.getContent();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr);
try{
responseEntity.getContent();
String x = EntityUtils.toString(responseEntity);
}catch (Exception e) {
// TODO: handle exception
}
responseJSONObject = g.fromJson(reader, JSONResponseObject.class);
Log.d(Constants.DEBUG_TAG_MAPS_console, responseJSONObject.toString());
reader.close();
System.gc();
}
}
} catch (Exception e) {
e.printStackTrace();
}
/code>
and on line :
InputStream is = responseEntity.getContent();
app is crashing ...response code is 200 ... I have looked on my tomcat logs and everything is ok. JSONResponseObject is filled with values and sended.
What could be the problem? How can I get stacktrace to logcat?
One maybe related problem: I have well know "Couldn't et connection factory client" in logcat Any of thing could causing that issue is not my case
- api key is correct, path to correct debug.keystore
- all permissions in manifest
- uses-library android:name="com.google.android.maps in manifest as well
Map is displayed correctly, refreshing on zooming/moving.
entity != nullshould be checkingresponseEntity