FelasDroid FelasDroid - 2 months ago 7x
Android Question

How i can get Response in String from Byte

i use AsyncHttpResponseHandler and i have this method:

public void onSuccess(int statusCode,
org.apache.http.Header[] headers,
byte[] responseBody) {



But now, how i can get a response in String from byte array ?

String str = new String(bytes, "UTF-8");

And if you're feeling lazy, you can use the Apache Commons IO library to convert the InputStream to a String directly:

String str = IOUtils.toString(inputStream, "UTF-8");