I'm using the loopj library (https://github.com/loopj/android-async-http) and it's recently changed to be compatible with API 23.
When submitting a 'put' request I would pass the StringEntity
into the put method like so:
client.put(CallApplication.getContext(),url, request.StringEntity, responseHandler);
My StringEntity
is an object that's converted into Json by doing:
public static StringEntity getJsonFromObject(Object object) {
String json = new Gson().toJson(object);
StringEntity stringEntity = null;
try {
stringEntity = new StringEntity(json, HTTP.UTF_8);
stringEntity.setContentType("text/json");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return stringEntity;
}
Now I need to use HttpEntity
instead and it's not clear how I can get it. How can I get my json string into the HttpEntity
?
As it happens there is a
cz.msebera.android.httpclient.entity.StringEntity
available to use. Who knew!
Cheers anyway