smanikandan14 / volley-demo Goto Github PK
View Code? Open in Web Editor NEWAn demonstration of Volley - HTTP library announced by google in I/O 2013. Illustrates, JSONRequest,StringRequest, Image caching.
An demonstration of Volley - HTTP library announced by google in I/O 2013. Illustrates, JSONRequest,StringRequest, Image caching.
Hello i'm using volley on my project, put i'm having an issue with the POST request. I'm looking a way to see the POST request (the response and post url) in order to check where is my problem. if it is on the parameters or on the rest api that i have done. using curl -i and curl--data the rest api is working fine. thank you
here is my code
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.POST,
url, null,
new Response.Listener() {
@Override
public void onResponse(JSONObject response) {
Log.i(TAG," The Response (Update): " + response.toString());
if (response != null) {
parseJSON(response,"update_existing");
}
/*
* Download the pizzules from the REST API
*/
puzzle_paths = new ArrayList<String>();
inizializePuzzles();
if (!puzzlesList.isEmpty())
{
for (int i =0; i<puzzlesList.size();i++)
{
puzzle_paths.add(puzzlesList.get(i).getPuzzlePath());
puzzle_paths.add(puzzlesList.get(i).getSolutionPath());
}
activity.runOnUiThread(new Runnable() {
public void run() {
new DownloadFile(activity,puzzle_paths);
}});
storePuzzles();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "The Error: " + error.toString());
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("date", date);
return params;
}
};
VolleyClass.getInstance().addToRequestQueue(jsonObjReq);
where date = 16-08-2014+14%3A31%3A37
also is there any available forum about volley?
MultiPartRequest can't upload file, I think the bug is in SslHttpStack,
setMultiPartBody(postRequest,request); //setEntity
setEntityIfNonEmptyBody(postRequest, request); //setEntity
you have set httpRequest.setEntity(entity) twice, so the MuliPartBody entity is override by getBody entity.
Hey there!
I've been trying to adapt your code to my own project, but I'm stucked with this problem.
(JSONObjectResponseActivity.java)
`jsonObjRequest = new JsonObjectRequest(Request.Method.GET, builder.toString(), null, new Response.Listener() {
@OverRide
public void onResponse(JSONObject response) {
try {
parseFlickrImageResponse(response);
mAdapter.notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
showToast("JSON parse error");
}
stopProgress();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Handle your error types accordingly.For Timeout & No connection error, you can show 'retry' button.
// For AuthFailure, you can re login with user credentials.
// For ClientError, 400 & 401, Errors happening on client side when sending api request.
// In this case you can check how client is forming the api and debug accordingly.
// For ServerError 5xx, you can do retry or handle accordingly.
if( error instanceof NetworkError) {
} else if( error instanceof ClientError) {
} else if( error instanceof ServerError) {
} else if( error instanceof AuthFailureError) {
} else if( error instanceof ParseError) {
} else if( error instanceof NoConnectionError) {
} else if( error instanceof TimeoutError) {
}
stopProgress();
showToast(error.getMessage());
}
});`
In this part of the code, ClientError cannot be resolved.
I've tried to import volley in several ways (.jar, compile 'com.android.volley:volley:1.0.0', compile 'com.mcxiaoke.volley:library:1.0.19', etc) but none of them can resolve import com.android.volley.ClientError;
I'd really appreciate any help you could give me.
Thanks in advance.
I am using multipart implementation of yours but I am getting TimeoutError a lot.
Actually, I don't know the difference but, there are TimeoutError and TimeoutException. I am setting timeout to 5 minutes using retry policy, if it exceeds 5 minutes it gives TimeoutException which is not bad. But sometimes, it give TimeoutError after like 10 seconds randomly.
Hi:
Could you please give me an sample about How to use MultiPartRequest?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.