{"record":{"id":"2f575486a8794fd6","repo":"YoKeyword/Fragmentation","slug":"must-impl-isupportactivity","errorCode":null,"errorMessage":" must impl ISupportActivity!","messagePattern":" must impl ISupportActivity!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"fragmentation_core/src/main/java/me/yokeyword/fragmentation/SupportFragmentDelegate.java","lineNumber":85,"sourceCode":"\n    /**\n     * Perform some extra transactions.\n     * 额外的事务：自定义Tag，添加SharedElement动画，操作非回退栈Fragment\n     */\n    public ExtraTransaction extraTransaction() {\n        if (mTransactionDelegate == null)\n            throw new RuntimeException(mFragment.getClass().getSimpleName() + \" not attach!\");\n\n        return new ExtraTransaction.ExtraTransactionImpl<>((FragmentActivity) mSupport, mSupportF, mTransactionDelegate, false);\n    }\n\n    public void onAttach(Activity activity) {\n        if (activity instanceof ISupportActivity) {\n            this.mSupport = (ISupportActivity) activity;\n            this._mActivity = (FragmentActivity) activity;\n            mTransactionDelegate = mSupport.getSupportDelegate().getTransactionDelegate();\n        } else {\n            throw new RuntimeException(activity.getClass().getSimpleName() + \" must impl ISupportActivity!\");\n        }\n    }\n\n    public void onCreate(@Nullable Bundle savedInstanceState) {\n        getVisibleDelegate().onCreate(savedInstanceState);\n\n        Bundle bundle = mFragment.getArguments();\n        if (bundle != null) {\n            mRootStatus = bundle.getInt(TransactionDelegate.FRAGMENTATION_ARG_ROOT_STATUS, STATUS_UN_ROOT);\n            mIsSharedElement = bundle.getBoolean(TransactionDelegate.FRAGMENTATION_ARG_IS_SHARED_ELEMENT, false);\n            mContainerId = bundle.getInt(TransactionDelegate.FRAGMENTATION_ARG_CONTAINER);\n            mReplaceMode = bundle.getBoolean(TransactionDelegate.FRAGMENTATION_ARG_REPLACE, false);\n            mCustomEnterAnim = bundle.getInt(TransactionDelegate.FRAGMENTATION_ARG_CUSTOM_ENTER_ANIM, Integer.MIN_VALUE);\n            mCustomExitAnim = bundle.getInt(TransactionDelegate.FRAGMENTATION_ARG_CUSTOM_EXIT_ANIM, Integer.MIN_VALUE);\n            mCustomPopExitAnim = bundle.getInt(TransactionDelegate.FRAGMENTATION_ARG_CUSTOM_POP_EXIT_ANIM, Integer.MIN_VALUE);\n        }\n\n        if (savedInstanceState == null) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/YoKeyword/Fragmentation/blob/0394930a3e2368f210df31f2632fb89b9c44e121/fragmentation_core/src/main/java/me/yokeyword/fragmentation/SupportFragmentDelegate.java#L67-L103","documentation":"In onAttach(), the delegate requires the hosting Activity to implement ISupportActivity so it can bind the TransactionDelegate and FragmentActivity reference. If the attached activity does not implement it, a RuntimeException naming the activity class is thrown.","triggerScenarios":"Attaching a SupportFragment to an Activity that does not implement ISupportActivity (e.g. a plain AppCompatActivity or a non-support container activity), whether via fragment transactions, dialogs, or viewpager hosting.","commonSituations":"Hosting a SupportFragment inside a regular activity (not SupportActivity); third-party container activities (e.g. image pickers, dialog hosts); forgetting to implement ISupportActivity when building a custom base activity.","solutions":["Extend SupportActivity for the host activity, or implement ISupportActivity with a SupportActivityDelegate in the activity.","If the fragment cannot be hosted by a support activity, use a plain Fragment instead of SupportFragment."],"exampleFix":"// before\npublic class HostActivity extends AppCompatActivity {\n// after\npublic class HostActivity extends SupportActivity {","handlingStrategy":"validation","validationCode":"if (!(hostActivity instanceof ISupportActivity)) {\n    // refuse to add the SupportFragment here\n}","typeGuard":"boolean canHostSupportFragment(Activity a) { return a instanceof ISupportActivity; }","tryCatchPattern":null,"preventionTips":["Every activity that hosts SupportFragments should extend SupportActivity.","Grep for support fragments added from non-support activities.","Document the host-activity requirement for reusable fragments."],"tags":["android","activity","interface-not-implemented"],"backgroundTag":"type-mismatch","analyzedSha":"0394930a3e2368f210df31f2632fb89b9c44e121","analyzedAt":"2026-09-10T13:16:30.469Z","contentChangedAt":"2026-09-10T13:16:30.469Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}