For some application on which I was working, for devices with API level 19 I'm getting exception
Caused by: java.lang.RuntimeException: Subclasses of PreferenceActivity must override isValidFragment(String) to verify that the Fragment class is valid! com... has not checked if fragment com...$. is valid.
Then, I found out that for those applications android frameworks protected boolean isValidFragment(String fragmentName)
is getting called, which has code
if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.KITKAT) {
throw new RuntimeException(
"Subclasses of PreferenceActivity must override isValidFragment(String)"
+ " to verify that the Fragment class is valid! " + this.getClass().getName()
+ " has not checked if fragment " + fragmentName + " is valid.");
} else {
return true;
}
Then I tried to replicate the error
I took my sample app's code from Preferences Activity Example
and added line <uses-sdk android:targetSdkVersion="19" />
in manifest.
But strangely, I'm not getting the error(isValidFragment() not getting called in that case).
So please tell me how to replicate that error in my sample app.