I refer to this link
http://developer.android.com/training/in-app-billing/list-iab-products.html
Dear All, I have to show the price of in-app products of my app from google play. Although I tried to get prices from google play as shown in link above... There is an error at
" for (String thisResponse : responseList) { "
telling that
"Type mismatch: cannot convert from element type Object to String".
how can i solve this error? or which way can I get in-app product price from google play?
Here is my code.
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();
}