问题描述
我使用的是地下城的应用实例,我使用的这个例子中提供的BillingService有类。
I am using the Dungeons application example and I am using the BillingService class provided in that example.
我使用的Java 6和@覆盖为我工作,但我得到一个编译错误在里面BillingService.java这两种方法:
I am using Java 6 and @override works for me, but I get a compile error on these two methods inside BillingService.java:
/**
* This is called when we are connected to the MarketBillingService.
* This runs in the main UI thread.
*/
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
if (Consts.DEBUG) {
Log.d(TAG, "Billing service connected");
}
mService = IMarketBillingService.Stub.asInterface(service);
runPendingRequests();
}
/**
* This is called when we are disconnected from the MarketBillingService.
*/
@Override
public void onServiceDisconnected(ComponentName name) {
Log.w(TAG, "Billing service disconnected");
mService = null;
}
会有人帮助我理解为什么会这样?
Would someone help me understand why this is happening?
谢谢!
推荐答案
我觉得你应该简单地从两种方法去除@Override装饰。我使用的是谷歌BillingService有一流的,这是我的方法:
I think you should simply remove the @Override decorator from both methods. I'm using the Google BillingService class and this is my method:
public void onServiceConnected(ComponentName name, IBinder service)
{
mService = IMarketBillingService.Stub.asInterface(service);
runPendingRequests();
}
正在实现一个接口,而不是扩展一个类有抽象方法。
You are implementing an interface, not extending a class with abstract methods.
这篇关于Android的inapp计费 - BillingService有与onServiceConnected和编译错误onServiceDisconnected的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!