當前位置: 首頁>>代碼示例>>Java>>正文


Java SharedPreferencesBackupHelper類代碼示例

本文整理匯總了Java中android.app.backup.SharedPreferencesBackupHelper的典型用法代碼示例。如果您正苦於以下問題:Java SharedPreferencesBackupHelper類的具體用法?Java SharedPreferencesBackupHelper怎麽用?Java SharedPreferencesBackupHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SharedPreferencesBackupHelper類屬於android.app.backup包,在下文中一共展示了SharedPreferencesBackupHelper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
	Log.d("ConnectBot.BackupAgent", "onCreate called");

	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

	SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
	addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefsHelper);

	FileBackupHelper hosts = new FileBackupHelper(this, "../databases/" + HostDatabase.DB_NAME);
	addHelper(HostDatabase.DB_NAME, hosts);

	if (prefs.getBoolean(PreferenceConstants.BACKUP_KEYS, PreferenceConstants.BACKUP_KEYS_DEFAULT)) {
		FileBackupHelper pubkeys = new FileBackupHelper(this, "../databases/" + PubkeyDatabase.DB_NAME);
		addHelper(PubkeyDatabase.DB_NAME, pubkeys);
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:BackupAgent.java

示例2: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
	// The name of the SharedPreferences file
	final String prefs = getPackageName() + "_preferences"; // getPackageName() cannot be used in final
	SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, prefs) {
		@Override
		public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
			ParcelFileDescriptor newState) {
			if (new WorkTimeTrackerBackupManager(WorkTimeTrackerBackupAgentHelper.this).isEnabled()) {
				super.performBackup(oldState, data, newState);
			}
		}
	};
	addHelper(PREFS_BACKUP_KEY, prefsHelper);

	DbBackupHelper dbHelper = new DbBackupHelper(this);
	addHelper(DB_BACKUP_KEY, dbHelper);
}
 
開發者ID:mathisdt,項目名稱:trackworktime,代碼行數:19,代碼來源:WorkTimeTrackerBackupAgentHelper.java

示例3: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    DbBackupHelper dataBaseBackupHelper =
            new DbBackupHelper(
                    this,
                    Storage.StorageHelper.DATABASE_NAME
            );
    SharedPreferencesBackupHelper mainSharedPreferencesBackupHelper =
            new SharedPreferencesBackupHelper(
                    this,
                    DEFAULT_PREFERENCE
                    );
    addHelper(BACKUP_PREFERENCE, mainSharedPreferencesBackupHelper);
    addHelper(BACKUP_DATABASE, dataBaseBackupHelper);
    super.onCreate();
}
 
開發者ID:heruoxin,項目名稱:Clip-Stack,代碼行數:17,代碼來源:GoogleBackupAgent.java

示例4: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    SharedPreferencesBackupHelper prefBackupHelper = new SharedPreferencesBackupHelper(this, DEFAULT_PREFS_FILENAME);
    addHelper(DEFAULT_PREFS_KEY, prefBackupHelper);

    // TODO not sure if need to implement synchronized since GreenDAO is thread safe...
    FileBackupHelper dbBackupHelper = new FileBackupHelper(this, StorageModule.DB_NAME);
    addHelper(PRINTER_DB_KEY, dbBackupHelper);
}
 
開發者ID:nairbspace,項目名稱:octoandroid,代碼行數:10,代碼來源:OctoBackupAgent.java

示例5: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate()
{
	// This is the preference name used by PreferenceManager.getDefaultSharedPreferences
	String prefs = getPackageName() + "_preferences";
	addHelper(BACKUP_KEY, new SharedPreferencesBackupHelper(this, prefs));
}
 
開發者ID:owoc,項目名稱:teardrop,代碼行數:8,代碼來源:PreferencesBackupAgent.java

示例6: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    // Compute the default preferences filename.
    String defaultPrefsFilename = getPackageName() + "_preferences";
    addHelper(PREFS_BACKUP_KEY,
            new SharedPreferencesBackupHelper(this, defaultPrefsFilename));
}
 
開發者ID:mridang,項目名稱:dashbar,代碼行數:8,代碼來源:BackupAgent.java

示例7: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
	Log.d("ConnectBot.BackupAgent", "onCreate called");

	SharedPreferencesBackupHelper prefs = new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
	addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefs);

	FileBackupHelper hosts = new FileBackupHelper(this, "../databases/" + HostDatabase.DB_NAME);
	addHelper(HostDatabase.DB_NAME, hosts);

	FileBackupHelper pubkeys = new FileBackupHelper(this, "../databases/" + PubkeyDatabase.DB_NAME);
	addHelper(PubkeyDatabase.DB_NAME, pubkeys);

}
 
開發者ID:dragonlinux,項目名稱:connectbot,代碼行數:15,代碼來源:BackupAgent.java

示例8: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    FileBackupHelper helperFileBackupHelper = new FileBackupHelper(this, HIGH_SCORES_FILENAME);
    addHelper(FILES_BACKUP_KEY, helperFileBackupHelper);

    SharedPreferencesBackupHelper helperSharedPreferencesBackupHelper =
            new SharedPreferencesBackupHelper(this, PREFS_DISPLAY, PREFS_SCORES);
    addHelper(MY_PREFS_BACKUP_KEY, helperSharedPreferencesBackupHelper);
}
 
開發者ID:GeeksEmpireNet,項目名稱:GoogleCloudApp_Tutorial,代碼行數:10,代碼來源:BackupAPI.java

示例9: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    // Hoo boy, there's a few prefs to back up...
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(
            this,
            GHDConstants.PREF_AUTOZOOM,
            GHDConstants.PREF_COORD_UNITS,
            GHDConstants.PREF_DEFAULT_GRATICULE_GLOBALHASH,
            GHDConstants.PREF_DEFAULT_GRATICULE_LATITUDE,
            GHDConstants.PREF_DEFAULT_GRATICULE_LONGITUDE,
            GHDConstants.PREF_DIST_UNITS,
            GHDConstants.PREF_INFOBOX,
            GHDConstants.PREF_KNOWN_LOCATIONS,
            GHDConstants.PREF_LAST_MAP_TYPE,
            GHDConstants.PREF_LAST_SEEN_VERSION,
            GHDConstants.PREF_NEARBY_POINTS,
            GHDConstants.PREF_SHOW_KNOWN_LOCATIONS,
            GHDConstants.PREF_STARTUP_BEHAVIOR,
            GHDConstants.PREF_STOCK_ALARM,
            GHDConstants.PREF_STOCK_CACHE_SIZE,
            GHDConstants.PREF_STOP_BUGGING_ME_PREFETCH_WARNING,
            GHDConstants.PREF_WIKI_PASS,
            GHDConstants.PREF_WIKI_USER,
            GHDConstants.PREF_NIGHT_MODE
    );
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
開發者ID:CaptainSpam,項目名稱:geohashdroid,代碼行數:28,代碼來源:GHDBackupAgent.java

示例10: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@SuppressLint("NewApi")
@Override
public void onCreate() {
    super.onCreate();
    String prefsName = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? PreferenceManager.getDefaultSharedPreferencesName(
            this) : getDefaultSharedPreferencesName(this);
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, prefsName);
    addHelper(PREFS_BACKUP_KEY, helper);
}
 
開發者ID:die-tageszeitung,項目名稱:tazapp-android,代碼行數:10,代碼來源:TazBackupHelper.java

示例11: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
    public void onCreate() {
//        getDatabasePath(DB_NAME).getAbsolutePath()
        FileBackupHelper dbs = new FileBackupHelper(this, DB_NAME);
        SharedPreferencesBackupHelper helper =
                new SharedPreferencesBackupHelper(this, getPackageName() + "_preferences");
        addHelper("prefs", helper);
        addHelper("dbs", dbs);
    }
 
開發者ID:rafaelcoutinho,項目名稱:cowbird,代碼行數:10,代碼來源:APBackupAgent.java

示例12: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
public void onCreate() {
	Context app = getApplicationContext();
	if (app instanceof DSCApplication) {
		mApplication = (DSCApplication) app;
	}
	SharedPreferencesBackupHelper helper =
			new SharedPreferencesBackupHelper(this, getDefaultSharedPreferencesName());
	addHelper(MY_PREFS_BACKUP_KEY, helper);
}
 
開發者ID:ciubex,項目名稱:dscautorename,代碼行數:10,代碼來源:DSCBackupAgent.java

示例13: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
	super.onCreate();

	// Back up all the preferences
	SharedPreferencesBackupHelper prefHelper = new SharedPreferencesBackupHelper(this, PREF_DEF);
	addHelper(KEY_PREF, prefHelper);
}
 
開發者ID:genious7,項目名稱:FanFictionReader,代碼行數:9,代碼來源:BackupAgent.java

示例14: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
  public void onCreate() {
  	
  	Log.v(TAG, "onCreate called");
  	
      SharedPreferencesBackupHelper prefs = new SharedPreferencesBackupHelper(this, getPackageName() +
      		"_preferences");
      addHelper(PreferenceConstants.BACKUP_PREF_KEY, prefs);
      
FileBackupHelper streams = new FileBackupHelper(this, "../databases/" + StreamDatabase.DATABASE_NAME);
addHelper(StreamDatabase.DATABASE_NAME, streams);

FileBackupHelper alarms = new FileBackupHelper(this, "../databases/" + DatabaseHelper.DATABASE_NAME);
addHelper(DatabaseHelper.DATABASE_NAME, alarms);
  }
 
開發者ID:wseemann,項目名稱:ServeStream,代碼行數:16,代碼來源:BackupAgent.java

示例15: onCreate

import android.app.backup.SharedPreferencesBackupHelper; //導入依賴的package包/類
@Override
public void onCreate() {
    SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, Constants.DEFAULT_PREFERENCES_FILE);
    addHelper(PREFS_BACKUP_KEY, helper);
    FileBackupHelper fileBackupHelper = new FileBackupHelper(this, Constants.REALM_FILE_NAME);
    addHelper(FILES_BACKUP_KEY, fileBackupHelper);
}
 
開發者ID:ceaseless-prayer,項目名稱:CeaselessAndroid,代碼行數:8,代碼來源:AppBackupAgentHelper.java


注:本文中的android.app.backup.SharedPreferencesBackupHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。