isValidFragment Android API 19

前端 未结 9 1981
你的背包
你的背包 2020-12-01 03:00

When I try my app with Android KitKat I have an error in PreferenceActivity.

Subclasses of PreferenceActivity must override isValidFragment(String) to ve

9条回答
  •  臣服心动
    2020-12-01 03:34

    Here's my headers_preferences.xml file:

      
      
    
        

    In my PreferencesActivity where the isValidFragment code occurs, I just turned it on its head:

    @Override
    protected boolean isValidFragment(String fragmentName)
    {
      //  return AppPreferencesFragment.class.getName().contains(fragmentName);
        return fragmentName.contains (AppPreferencesFragment.class.getName());
    }
    

    As long as I use the AppPreferencesFragment string at the start of all my fragment names, they all validate just fine.

提交回复
热议问题