我正在进行像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);