private void addProductToCart(String productId) {

    CartentiaApplication.MY_CART_PRODUCTS.add(productId);
    AddCartRequest addCartRequest = new AddCartRequest();
    addCartRequest.setUserID(PreferenceManager.getUserID());
    addCartRequest.setProductID(productId);
    addCartRequest.setGroupID(PreferenceManager.getGroupID());
    addCartRequest.setID(1);
    String jsnRequest = new Gson().toJson(addCartRequest);
    Request request =
        new JsonPostRequestHandler(
            Request.Method.POST,
            Constants.Url.ADD_CART,
            jsnRequest,
            AddMyCartResponse.class,
            new Response.Listener<AddMyCartResponse>() {
              @Override
              public void onResponse(AddMyCartResponse response) {}
            },
            new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {}
            });
    VolleyManager.getInstance().addRequestToQueue(request, "AddCart");
  }
 private void handleIntent(Intent intent) {
   if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())
       || NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())
       || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
     Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
     if (rawMsgs != null) {
       ndefMessages = new NdefMessage[rawMsgs.length];
       for (int i = 0; i < rawMsgs.length; i++) {
         ndefMessages[i] = (NdefMessage) rawMsgs[i];
       }
     }
     if (ndefMessages != null && ndefMessages.length > 0) {
       String productId = new String(ndefMessages[0].getRecords()[0].getPayload());
       productId = productId != null ? productId.replace("en", "") : "Invalid Product tag";
       // Toast.makeText(getBaseContext(), body != null ? body.replace("en", "") : "Invalid Product
       // tag", Toast.LENGTH_LONG).show();
       productId = productId.replace(String.valueOf(productId.charAt(0)), "");
       if (!CartentiaApplication.MY_CART_PRODUCTS.contains(productId)) {
         addProductToCart(productId);
         loadAddProductFragment(productId);
       } else {
         Toast.makeText(
                 getBaseContext(), "Product is already added into your cart", Toast.LENGTH_LONG)
             .show();
       }
     } else {
       Toast.makeText(getBaseContext(), " Empty Product tag", Toast.LENGTH_LONG).show();
     }
   }
 }