[android]代码库
package net.helpsd.cg;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import java.util.List;
public class SettingsActivity extends PreferenceActivity {
public static class GeneralFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_header_general);
}
}
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.pref_settings, target);
}
@Override
protected boolean isValidFragment(String fragmentName) {
boolean ret = PreferenceFragment.class.getName().equals(fragmentName);
ret = ret || GeneralFragment.class.getName().equals(fragmentName);
return ret;
}
}