Created
March 28, 2013 03:08
-
-
Save davetrux/5260231 to your computer and use it in GitHub Desktop.
Another static Android API example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("deprecation") | |
public class Settings extends PreferenceActivity { | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB ) | |
addPreferencesFromResource(R.xml.settings); | |
else | |
addPreferencesAPIv11(); | |
} | |
private void addPreferencesAPIv11() { | |
getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefFragment()).commit(); | |
} | |
public static class PrefFragment extends PreferenceFragment | |
{ | |
@Override | |
public void onCreate(final Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
addPreferencesFromResource(R.xml.settings); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment