Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MateusAndreatta/279ae241cef637e1f8f6102edcbe18f9 to your computer and use it in GitHub Desktop.
Save MateusAndreatta/279ae241cef637e1f8f6102edcbe18f9 to your computer and use it in GitHub Desktop.
Base de volley
// dialog para dar um feedback ao usuario
progressDialog.setMessage(getResources().getString(R.string.loadingRegistros));
progressDialog.show();
// string request
StringRequest stringRequest = new StringRequest(Request.Method.POST, JSON_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// tirar o dialog
progressDialog.dismiss();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//tirar o dialog
progressDialog.dismiss();
}
}) {
@Override
protected Map<String, String> getParams() {
// Creating Map String Params.
Map<String, String> params = new HashMap<String, String>();
// Adding All values to Params.
params.put(/*"name do php"*/, /*Valor*/);
return params;
}
};
requestQueue.getCache().clear();
requestQueue.add(stringRequest);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment