Move switch preference into its own demo.

This avoids everything breaking on pre-ICS platforms.

Also get rid of pref initialization in Application. I hate that.  Hate
hate hate.  Hate.  Totally hate.

Totally.

Change-Id: Idb3526a96eb2dff49f9de8e5ae71149cb4ed6e96
This commit is contained in:
Dianne Hackborn
2011-11-14 14:28:42 -08:00
parent d673b70dfd
commit 2fd75c6368
11 changed files with 123 additions and 50 deletions

View File

@@ -17,12 +17,12 @@
package com.example.android.apis;
import android.app.Application;
import android.preference.PreferenceManager;
/**
* This is an example of a {@link android.app.Application} class. Ordinarily you would use
* a class like this as a central repository for information that might be shared between multiple
* activities.
* This is an example of a {@link android.app.Application} class. This can
* be used as a central repository for per-process information about your app;
* however it is recommended to use singletons for that instead rather than merge
* all of these globals from across your application into one place here.
*
* In this case, we have not defined any specific work for this Application.
*
@@ -30,17 +30,7 @@ import android.preference.PreferenceManager;
* of how to perform unit tests on an Application object.
*/
public class ApiDemosApplication extends Application {
@Override
public void onCreate() {
/*
* This populates the default values from the preferences XML file. See
* {@link DefaultValues} for more details.
*/
PreferenceManager.setDefaultValues(this, R.xml.default_values, false);
}
@Override
public void onTerminate() {
}
}