应用内结算 mPurchaseFinishedListener 错误
In-app billing mPurchaseFinishedListener error
我遵循了this指南,在指南的中间我遇到了这个方法:
public void buyClick(View view) {
mHelper.launchPurchaseFlow(this, ITEM_SKU, 10001,
mPurchaseFinishedListener, "mypurchasetoken");
}
我需要将它复制到我的应用程序代码中,出于某种原因,mPurchaseFinishedListener(我正在使用 Android Studio)是红色的(意味着有一个错误)。
当我用鼠标悬停在 mPurchaseFinishedListener 时,Android 工作室说 "Cannot resolve simbol 'mPurchaseFinishedListener'"。
现在显然我做错了什么,有人可以帮助我吗?
谢谢你
您是否在链接的教程中将 IabHelper.OnIabPurchaseFinishedListener
实现为 suggested?
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result,
Purchase purchase)
{
if (result.isFailure()) {
// Handle error
return;
}
else if (purchase.getSku().equals(ITEM_SKU)) {
consumeItem();
buyButton.setEnabled(false);
}
}
};
我遵循了this指南,在指南的中间我遇到了这个方法:
public void buyClick(View view) {
mHelper.launchPurchaseFlow(this, ITEM_SKU, 10001,
mPurchaseFinishedListener, "mypurchasetoken");
}
我需要将它复制到我的应用程序代码中,出于某种原因,mPurchaseFinishedListener(我正在使用 Android Studio)是红色的(意味着有一个错误)。
当我用鼠标悬停在 mPurchaseFinishedListener 时,Android 工作室说 "Cannot resolve simbol 'mPurchaseFinishedListener'"。
现在显然我做错了什么,有人可以帮助我吗?
谢谢你
您是否在链接的教程中将 IabHelper.OnIabPurchaseFinishedListener
实现为 suggested?
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result,
Purchase purchase)
{
if (result.isFailure()) {
// Handle error
return;
}
else if (purchase.getSku().equals(ITEM_SKU)) {
consumeItem();
buyButton.setEnabled(false);
}
}
};