Recyclerview with footer not able to delete last item

依然范特西╮ 提交于 2019-11-30 16:43:23

This is just a guess but you are not parsing your packId while re initializing your list after deleting one item.

if(person.getString("responseCode").equals("1"))
{

    JSONArray itemslist=person.optJSONArray("itemList");

    if(itemslist==null)
    {

        Toast.makeText(BuyNowActivity.this, "Your Shopping Cart is Empty", Toast.LENGTH_SHORT).show();

    }
    else {

        for (int j = 0; j < itemslist.length(); j++) {

            JSONObject cartitems = itemslist.getJSONObject(j);
            CartModel cvm = new CartModel();
            cvm.setCart_Product_Name(cartitems.getString("prodNarration"));
            cvm.setCart_Product_Price(cartitems.getString("finalPrice"));
            cvm.setCart_Product_Id(cartitems.getString("productId"));
            cvm.setCart_Product_Img(cartitems.getString("packLink"));
            cvm.setCart_Product_Qty(cartitems.getString("qty"));
            cvm.setCart_Product_packDiscount(cartitems.getString("packDIscDesc"));

            // HERE add some code for parsing packId

            cartlist.add(cvm);
        }

        Toast.makeText(BuyNowActivity.this, "Product Removed Successfully", Toast.LENGTH_SHORT).show();
    }
}

Try adding the parsing code where i have added comment.

Hope this will help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!