无法为应用内结算实例化类型错误

时间:2012-11-27 15:58:35

标签: android in-app-purchase

我正在尝试实施inapp计费功能,我在主要活动中有以下内容:

public class screen_Home extends base_Activity{
...
private AppPurchaseObserver appPurchaseObserver;
private Handler handler;
...
private abstract class AppPurchaseObserver extends PurchaseObserver {
    public AppPurchaseObserver(Handler handler) {
         super(BT_screen_home.this, handler);
    }
}
...

在onCreate中:

...
handler = new Handler();         
appPurchaseObserver = new AppPurchaseObserver(handler); 
....

在最后一行,AppPurchaseObserver在Eclipse中用红色加下划线给出错误:无法实例化类型screen_Home.AppPurchaseObserver

我做错了什么?

感谢您的帮助

2 个答案:

答案 0 :(得分:0)

无法实例化抽象类。您可以在Java Here 中阅读有关抽象类的更多信息。取出abstract标识符,您可以实例化AppPurchaseObserver

答案 1 :(得分:0)

尝试import android.os.Handler;

而不是import java.util.logging.Handler;