我指的是這個鏈接得到應用內谷歌產品的價格起到
http://developer.android.com/training/in-app-billing/list-iab-products.html
親愛的,我 必須表明的應用內產品我的應用程序從谷歌的價格玩。 雖然我試圖讓如上面的鏈接價格從谷歌玩... 有一個在
" for (String thisResponse : responseList) { "
的錯誤,告訴
"Type mismatch: cannot convert from element type Object to String".
我怎樣才能解決這個問題? 或我可以通過哪種方式從Google Play獲得應用內商品價格?
這是我的代碼。
ArrayList skuList = new ArrayList();
skuList.add("000001");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
String mPackagePrice;
try {
Bundle skuDetails = mService.getSkuDetails(3,
getPackageName(), "inapp", querySkus);
int response = skuDetails.getInt("RESPONSE_CODE");
if (response == 0) {
ArrayList responseList
= skuDetails.getStringArrayList("DETAILS_LIST");
for (String thisResponse : responseList) {
JSONObject object = new JSONObject(thisResponse);
String sku = object.getString("productId");
String price = object.getString("price");
if (sku.equals("000001")) mPackagePrice = price;
}
}
} catch (RemoteException e) {
e.printStackTrace();
}