简体   繁体   中英

Change Button style, text and onClick event after successful in-app billing transaction

How do I change the text, style and onClick behavior of a Button in Android app after the BillingResponse is received as RESULT_OK from the server?

This will let the user know that he has purchased the app previously!

Please help me out!

I suggest that: When you get the RESULT_OK callback save with SharedPreferences .

sp.edit().putBoolean("purchased", true).commit();

And in the onCreate method of your Activity call

boolean purchased = sp.getBoolean("purchased", false);

Depending on the state of the purchased boolean you apply the style, onclick, ..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM