Why does Kit Kat require the use of the isValidFragment?

前端 未结 4 2459
北恋
北恋 2021-02-20 11:09

Ever since KitKat was released, I\'ve noticed a whole bunch of my apps updating with \"Fixing a crash in Kit Kat\". Recently when I released my own app, I figured out the likely

4条回答
  •  梦毁少年i
    2021-02-20 11:53

    You got this documented:

    Subclasses should override this method and verify that the given fragment is a valid type to be attached to this activity. The default implementation returns true for apps built for android:targetSdkVersion older than KITKAT. For later versions, it will throw an exception.

    so as long as your targetSdk is below 19, you do not need to care. If it is 19 then your app will crash due to the exception, unless you implement isValidFragment()..

提交回复
热议问题