List of usage examples for android.app.backup BackupManager dataChanged
public static void dataChanged(String packageName)
From source file:com.sakisds.icymonitor.activities.AddServerActivity.java
private void saveServer(String url) { // Save data/*from w ww . j ava2s . c o m*/ int currentServer = mSettings.getInt("serverCount", 0); SharedPreferences.Editor editor = mSettings.edit(); editor.putString("server_" + String.valueOf(currentServer) + "_name", mEditText_name.getText().toString()); editor.putString("server_" + String.valueOf(currentServer) + "_address", url); editor.putInt("server_" + String.valueOf(currentServer) + "_type", mSpinner.getSelectedItemPosition()); editor.putInt("serverCount", currentServer + 1); editor.commit(); BackupManager.dataChanged("com.sakisds.icymonitor"); // Exit activity finish(); }
From source file:uk.org.rivernile.edinburghbustracker.android.SettingsDatabase.java
/** * Insert a new favourite stop in to the database. * * @param stopCode The stop code to insert. * @param stopName The stop name to insert. * @throws SQLException If an error occurs whilst writing to the database. *///from w w w .j ava 2 s . c om public void insertFavouriteStop(final String stopCode, final String stopName) throws SQLException { if (stopCode == null || stopName == null || stopCode.length() == 0 || stopName.length() == 0) return; if (getFavouriteStopExists(stopCode)) return; final ContentValues cv = new ContentValues(); cv.put(FAVOURITE_STOPS_STOPCODE, stopCode); cv.put(FAVOURITE_STOPS_STOPNAME, stopName); final SQLiteDatabase db = getWritableDatabase(); db.insertOrThrow(FAVOURITE_STOPS_TABLE, FAVOURITE_STOPS_STOPNAME, cv); BackupManager.dataChanged(context.getPackageName()); }
From source file:uk.org.rivernile.edinburghbustracker.android.SettingsDatabase.java
/** * Delete a favourite stop from the database. * * @param stopCode The stop code to delete from the database. *///from w w w.java2s .com public void deleteFavouriteStop(final String stopCode) { if (stopCode == null || stopCode.length() == 0) return; if (!getFavouriteStopExists(stopCode)) return; final SQLiteDatabase db = getWritableDatabase(); db.delete(FAVOURITE_STOPS_TABLE, FAVOURITE_STOPS_STOPCODE + " = ?", new String[] { stopCode }); BackupManager.dataChanged(context.getPackageName()); }
From source file:uk.org.rivernile.edinburghbustracker.android.SettingsDatabase.java
/** * Modify the stopName string of an item in the database. * * @param stopCode The stop code of the item to modify. * @param stopName The new stop name./* w ww. j a v a 2 s. c om*/ */ public void modifyFavouriteStop(final String stopCode, final String stopName) { if (stopCode == null || stopName == null || stopCode.length() == 0 || stopName.length() == 0) return; if (!getFavouriteStopExists(stopCode)) return; final ContentValues cv = new ContentValues(); cv.put(FAVOURITE_STOPS_STOPNAME, stopName); final SQLiteDatabase db = getWritableDatabase(); db.update(FAVOURITE_STOPS_TABLE, cv, FAVOURITE_STOPS_STOPCODE + " = ?", new String[] { stopCode }); BackupManager.dataChanged(context.getPackageName()); }