Android应用内结算Trivial Drive

时间:2015-10-17 09:38:42

标签: android in-app-purchase sku

我正在进行像TrivialDrive这样的应用内购买。调用queryInventoryAsync:

 mHelper.queryInventoryAsync(mGotInventoryListener);

mGotInventoryListener:

IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {

        String price = inventory.getSkuDetails(SKU_ALL_INCLUSILE).getPrice();
        Log.d("SKU", "price " + price);
    }
};

OnClick工作完美,我可以购买。但getPrice()方法产生NPE。请帮帮我!我想在ListView中显示SKU信息。

解决了!只需使用:

 mHelper.queryInventoryAsync(true, skuList, mGotInventoryListener);

0 个答案:

没有答案