我想打电话给一个onClick监听器里这种方法:如何在Android中的onClick监听器中获取类引用?
mHelper.launchPurchaseFlow(this,
SKU_INFINITE_GAS, IabHelper.ITEM_TYPE_SUBS,
RC_REQUEST, mPurchaseFinishedListener, payload);
但由于它是一个onClick监听器里,引用这将成为没有参考类,但听者的onClick。如果此代码位于onClick侦听器中,是否有传递类引用的方法?
谢谢!
尝试使用getApplicationContext ()而不是这个 –
谢谢大家。我得到了这个解决:) – Genadinik
这看起来像一个类似的问题,已经发布在这里:[http://stackoverflow.com/questions/23676634/use-variable-defined-in-one-event-in-other-event/ 23677099#23677099](http://stackoverflow.com/questions/23676634/use-variable-defined-in-one-event-in-other-event/23677099#23677099)我希望它可以帮助亲切的问候 – LorToso