Class model.
public class test {
private String longDescription;
private String productName;
private String name;
private String productId;
private String catalogName;
private String categoryName;
private String subCategoryName;
private int kidId;
public String getLongDescription() {
return longDescription;
}
public void setLongDescription(String longDescription) {
this.longDescription = longDescription;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getCatalogName() {
return catalogName;
}
public void setCatalogName(String catalogName) {
this.catalogName = catalogName;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getSubCategoryName() {
return subCategoryName;
}
public void setSubCategoryName(String subCategoryName) {
this.subCategoryName = subCategoryName;
}
public int getKidId() {
return kidId;
}
public void setKidId(int kidId) {
this.kidId = kidId;
}
}
The VolleyJsonPost method from the VolleyConnection class that I wrote:
public static void jsonPost(Context context, String url, JSONObject jsonObject, Response.Listener<JSONObject> responceListener, Response.ErrorListener errorListener)
{
JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST,url,jsonObject,responceListener,errorListener);
Volley.newRequestQueue(context).add(jsonRequest);
}
and you use this method:
VolleyConnection.jsonPost(context, rootUrl, jsonObject, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
}
});
}
source
share