0
我無法設置應用內結算功能。正如在文檔中所寫的,我已經完成了所有的任務,直到後面的代碼。Android應用內結算錯誤 - mQueryFinishedListener無法解析爲變量
package com.fstaer.android;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.example.android.trivialdrivesample.util.IabHelper;
import com.example.android.trivialdrivesample.util.IabHelper.QueryInventoryFinishedListener;
import com.example.android.trivialdrivesample.util.IabResult;
import com.example.android.trivialdrivesample.util.Inventory;
import com.example.android.trivialdrivesample.util.Purchase;
public class Getcredits extends Activity{
IabHelper mHelper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.purchase_credits);
String base64EncodedPublicKey = "my public key setup successfully";
// compute your public key and store it in base64EncodedPublicKey
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d("getcr", "Problem setting up In-app Billing: " + result);
}
// Hooray, IAB is fully set up!
List additionalSkuList = new ArrayList();
additionalSkuList.add("record_pack1");
//additionalSkuList.add(SKU_BANANA);
mHelper.queryInventoryAsync(true, additionalSkuList,
mQueryFinishedListener);
}
});
}
@Override
public void onDestroy() {
super.onDestroy();
if (mHelper != null) mHelper.dispose();
mHelper = null;
}
}
我收到錯誤 - mQueryFinishedListener不能被解析爲一個變量
如果我把QueryInventoryFinishedListener mQueryFinishedListener = null;
它創建顯示java.lang.NullPointerException 請人幫我在應用程式設定帳單
謝謝。現在正在工作 – user2166537 2013-03-13 17:25:12
@ user2166537請點擊勾號接受答案。 – 2013-03-13 17:30:33
@RaghavSood你有沒有遇到Inapp賬單中的多用戶錯誤? http://stackoverflow.com/questions/15263889/does-in-app-billing-support-multiple-accounts/15492261#15492261 – 2013-03-19 05:55:20