Fragment中没有onActivityResult().对于应用内结算

Chr*_*fer 2 java android in-app-billing

我正在关注Google的教程和代码示例,了解如何实施应用内结算.问题是我在片段中这样做.

直到最后一步,一切似乎都没有实现,但是我应该实现这个方法:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
        if (mHelper == null) return;

        // Pass on the activity result to the helper for handling
        if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
            // not handled, so handle it ourselves (here's where you'd
            // perform any handling of activity results not related to in-app
            // billing...
            super.onActivityResult(requestCode, resultCode, data);
        }
        else {
            Log.d(TAG, "onActivityResult handled by IABUtil.");
        }
    }
Run Code Online (Sandbox Code Playgroud)

问题当然是片段中不存在这种受保护的方法.只有一种公共方法,在完成应用内购买时不会被调用.