List of usage examples for android.preference PreferenceManager setDefaultValues
public static void setDefaultValues(Context context, @XmlRes int resId, boolean readAgain)
From source file:Main.java
public static void initPreferences(Context context, int resId) { PreferenceManager.setDefaultValues(context, resId, false); }
From source file:de.nware.app.hsDroid.data.StaticSessionData.java
public static SharedPreferences getSharedPrefs(Context context) { if (sPreferences == null) { // Standardwerte setzen PreferenceManager.setDefaultValues(context, R.xml.preferencescreen, false); // SharedPreferences laden sPreferences = PreferenceManager.getDefaultSharedPreferences(context); }//w ww . j a v a 2 s .c om return sPreferences; }
From source file:de.fahrgemeinschaft.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PreferenceManager.setDefaultValues(this, R.xml.settings, false); FragmentManager fm = getSupportFragmentManager(); main = (MainFragment) fm.findFragmentByTag(MAIN); results = (RideListFragment) fm.findFragmentByTag(getString(R.string.results)); if (results == null) results = new RideListFragment(); results.setSpinningEnabled(true);/* www. j a va 2s .c o m*/ details = (RideDetailsFragment) fm.findFragmentByTag(getString(R.string.details)); if (details == null) details = new RideDetailsFragment(); if (savedInstanceState == null) { handleIntent(getIntent()); } }
From source file:net.grayswander.rotationmanager.SettingsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_SETTINGS) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.WRITE_SETTINGS }, WRITE_SETTINGS_PERMISSION_REQUEST); }/*from ww w . ja va2s . com*/ }
From source file:net.evenh.chargingstations.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set default values PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Check for internet connectivity dialog = new AlertDialog.Builder(this).setTitle(R.string.internet_dialog_title) .setMessage(R.string.internet_dialog_message).setCancelable(true) .setNegativeButton(R.string.internet_dialog_cancel, new DialogInterface.OnClickListener() { @Override/*from www . j a va 2 s . c om*/ public void onClick(DialogInterface dialog, int which) { finish(); } }).setPositiveButton(R.string.internet_dialog_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (!hasClicked) { hasClicked = true; startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); hasClicked = false; } } }).create(); // Check for Google Play Services int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); if (status == ConnectionResult.SUCCESS) { TabAdapter = new TabPagerAdapter(getFragmentManager()); Tab = (ViewPager) findViewById(R.id.pager); Tab.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar = getActionBar(); actionBar.setSelectedNavigationItem(position); } }); Tab.setAdapter(TabAdapter); actionBar = getActionBar(); //Enable Tabs on Action Bar if (actionBar != null) actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tabListener = new ActionBar.TabListener() { @Override public void onTabReselected(android.app.ActionBar.Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { Tab.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(android.app.ActionBar.Tab tab, FragmentTransaction ft) { } }; //Add New Tab actionBar.addTab(actionBar.newTab().setText(R.string.near_me).setIcon(R.drawable.ic_action_place) .setTabListener(tabListener)); actionBar.addTab(actionBar.newTab().setText(R.string.search).setIcon(R.drawable.ic_action_search) .setTabListener(tabListener)); } else { // Google Play Services error handling Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, -1); dialog.show(); } }
From source file:com.appdynamics.demo.gasp.service.RestaurantSyncService.java
private void getGaspRestaurantsUriSharedPreferences() { PreferenceManager.setDefaultValues(this, R.xml.preferences, false); SharedPreferences gaspSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String gaspRestaurantsUri = gaspSharedPreferences.getString(getString(R.string.gasp_server_uri_preferences), "") + getString(R.string.gasp_restaurants_location); this.mGaspRestaurantsUri = Uri.parse(gaspRestaurantsUri); }
From source file:org.jraf.android.hellomundo.app.preference.PreferenceActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); addPreferencesFromResource(R.xml.preferences); updateSummary();/*from w ww . j a va2s.c o m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:com.rukiasoft.androidapps.cocinaconroll.ui.ToolbarAndRefreshActivity.java
protected void setDefaultValuesForOptions(int id) { PreferenceManager.setDefaultValues(this, id, false); }
From source file:at.ac.uniklu.mobile.sportal.StudentportalApplication.java
@Override public void onCreate() { super.onCreate(); // docs say this is needed // load default preferences but don't overwrite user set ones PreferenceManager.setDefaultValues(this, R.xml.debug_preferences, false); mStudentportal = Studentportal.initialize(this); sInstance = this; Analytics.init(this); upgradeHousekeeping();// ww w. j a v a2 s .com }
From source file:de.nware.app.hsDroid.data.StaticSessionData.java
public static void resetSharedPreferences(Context context) { if (sPreferences != null) { PreferenceManager.setDefaultValues(context, R.xml.preferencescreen, true); }//from w ww . j a va 2 s .c o m }