1. satejinfotech's Avatar
    I have wrritten following code to pass three parameters to web service

    Code:

    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>() {
    @Override
    public void onResponse(JSONObject jsonObject) {
    // Log.e("jsonObject", "" + jsonObject.toString());
    handleProductStockDataResponse(jsonObject);
    }
    }, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError volleyError) {
    System.out.println("Error In Web : " + volleyError.getMessage());
    cc.cancelProgressDialog(activity);
    }
    }) {
    @Override
    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);
    customRequest.setRetryPolicy(policy);
    // 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.
    06-04-2016 05:54 AM
  2. ManiacJoe's Avatar
    I have wrritten following code to pass three parameters to web service

    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.
    If by "parameters are passed" you mean "they have data in them", you can check the string lengths prior to the param.put() calls.
    06-04-2016 09:31 AM

Similar Threads

  1. In car hands free - Galaxy S6 won't talk to me
    By adingley84 in forum Android 6.0 Marshmallow
    Replies: 1
    Last Post: 06-07-2016, 04:59 AM
  2. I want reject list option in moto g3 generation
    By AC Question in forum Ask a Question
    Replies: 0
    Last Post: 06-04-2016, 05:35 AM
LINK TO POST COPIED TO CLIPBOARD