Skip to content

Instantly share code, notes, and snippets.

@lithid
Created December 12, 2013 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lithid/7932148 to your computer and use it in GitHub Desktop.
Save lithid/7932148 to your computer and use it in GitHub Desktop.
Android PreferenceActivity fix
@TargetApi(Build.VERSION_CODES.KITKAT)
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
if (android.os.Build.VERSION.SDK_INT >= C.SDK_19) {
if (!isValidFragment(initialFragment)) {
throw new IllegalArgumentException("Invalid fragment for this activity: "
+ initialFragment);
}
}
getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, new SimplePreferenceFragment())
.commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment