wdtheprovider / in-app-purchases-subscription

Working on Android In-App Purchases for Google Play billing library with the latest version 6.0.0+
https://github.com/wdtheprovider/in-app-purchases-subscription
129 stars 42 forks source link

Im not using recylerView Im just using Grid Layout for button for subscriptions. #5

Closed smitxdev closed 1 year ago

smitxdev commented 1 year ago

Im not using recylerView Im just using Grid Layout for button for subscriptions. it has been succesfull but i want getPrice of product and set it as text in textview please help

wdtheprovider commented 1 year ago

Hi, sorry for the super late reply, i was held up so bad.

Please check the following code:

this is in showProduct() method. `` billingClient.queryProductDetailsAsync(params, (billingResult, list) -> { productDetailsList.clear(); handler.postDelayed(() -> { loadProducts.setVisibility(View.INVISIBLE); // productDetailsList.addAll(list); - this is where you add the list of products into productDetailsList List

            Here I used a recyclerviewer but I removed it and replaced it with the following code. 

           ProductDetails currentItem = **productDetailsList**.get(position);
           List<ProductDetails.SubscriptionOfferDetails> **subDetails** = currentItem.getSubscriptionOfferDetails();

           Then number to get the price do this: 
          price =  **subDetails**.get(0).getPricingPhases().getPricingPhaseList().get(0).getFormattedPrice();

        }, 2000);
    });

``