[英]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? 从服务器收到RESULT_OK的BillingResponse后,如何更改Android应用程序中Button的文本,样式和onClick行为?
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 . 我建议:当您获得RESULT_OK回调时,请使用SharedPreferences保存。
sp.edit().putBoolean("purchased", true).commit();
And in the onCreate method of your Activity call 然后在Activity调用的onCreate方法中
boolean purchased = sp.getBoolean("purchased", false);
Depending on the state of the purchased boolean you apply the style, onclick, .. 根据所购买布尔值的状态,您可以应用样式onclick 、.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.