1. Everything Android is a community forum that makes it easy to ask questions about anything and everything Android. It's 100% free and no registration required (though we think it would be awesome if you joined our community). Our community of experts are here to help.
    Dismiss Notice

I want to code for android application in which there are three parameters

Discussion in 'Android Questions' started by Roopali Parandekar, Jun 4, 2016.

  1. Roopali Parandekar

    Roopali Parandekar New Member

    Jun 4, 2016

    Sponsored Ad

    I want to code for android application in which there are three parameters which i want to pass to php-webservice.

    I have wrritten following code to pass three parameters to web service


    private void getProductStock(String productStock_StyleID, String productStock_SizeID, String productStock_colorID){
    if(cc.isNetAvailable(context)) {
    String url = CommonClass.MainWebUrl + CommonClass.WebApi.GET_PRODUCT_STOCK;
    Map params = new HashMap();

    params.put("style_id", productStock_StyleID);
    params.put("size_id", productStock_SizeID);
    params.put("color", productStock_colorID);

    fetchProductStockQuantity(ViewBrandsActivity.this, url, params);

    } else {
    CommonClass.showToast(getApplicationContext(), CommonClass.ErrorMessage.Network_Error);

    public void fetchProductStockQuantity(final Activity activity, String url, Map param) {

    Map map = new HashMap();
    map = param;
    cc.showProgressDialog("Fetching stock quantity..", activity);
    CustomRequest customRequest = new CustomRequest(Request.Method.POST,
    url, param, new Response.Listener<JSONObject>() {
    public void onResponse(JSONObject jsonObject) {
    // Log.e("jsonObject", "" + jsonObject.toString());
    }, new Response.ErrorListener() {
    public void onErrorResponse(VolleyError volleyError) {
    System.out.println("Error In Web : " + volleyError.getMessage());
    }) {
    public Map<String, String> getHeaders() throws AuthFailureError {
    HashMap<String, String> headers = new HashMap<String, String>();
    //headers.put("Content-Type", "application/x-www-form-urlencoded");
    return headers;
    int socketTimeout = 100000;//60 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout,
    DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    // Adding request to request queue
    AppController.getInstance().addToRequestQueue(customRequest, url);


    this webservice returns a value which i want to display in my android application.
    How do I check if the 3 parameters are passed to the webservice?
    Please tell me above code is currect or not and also tell me how to show that return value in my android application.

Share This Page