Back to project page Projectile.
The source code is released under:
Apache License
If you think the Android project Projectile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.nicktate.projectile; /* w ww . j a v a 2s . c o m*/ import com.android.volley.NetworkResponse; import com.android.volley.toolbox.HttpHeaderParser; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import java.io.UnsupportedEncodingException; /** * Convenience listener that returns a {@link com.google.gson.JsonElement} */ public abstract class JsonElementListener implements ResponseListener<JsonElement> { @Override public JsonElement responseParser(NetworkResponse networkResponse) { String response; try { response = new String(networkResponse.data, HttpHeaderParser.parseCharset(networkResponse.headers)); } catch (UnsupportedEncodingException e) { response = new String(networkResponse.data); } return new JsonParser().parse(response); } }