In-app billing workflow in a ListView

前端 未结 2 975
我在风中等你
我在风中等你 2021-01-06 09:52

I implemented in-app billing in Android application, have like 6 product they are like coins the user will buy in order to buy items in my app. The setup and the testing for

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-06 10:30

    change your class to these

    public class BankClass {
    
        public int itemId;
        public int quantity;
        public String Price;
    
        public BankClass(int _itemId,int _quantity,String _Price){
            itemId = _itemId;
            quantity = _quantity;
            Price = _Price;
        }
    
        public int getItemId() {
            return itemId;
        }
    
        public String getPrice() {
            return Price;
        }
    
        public int getQuantity() {
            return quantity;
        }
    }
    

    in listitem click change these all code like bewlo

    BankClass currentItem = BankList.get(position);
                        CoinItemID = currentItem.getItemId();
                        if (currentItem.getQuantity() == 100)
                        {
                            CoinItemID = currentItem.getItemId();
                            String payload = "";
                            mHelper.launchPurchaseFlow(BankActivity.this, SKU_hundred, RC_REQUEST,
                                    mPurchaseFinishedListener, payload);
    
                        }
    

提交回复
热议问题