我参考这个链接
http://developer.android.com/training/in-app-billing/list-iab-products.html
亲爱的大家,我必须从 google play 显示我的应用的应用内产品的价格。虽然我试图从 google play 获取价格,如上面的链接所示......有一个错误
" 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();
}