コード例 #1
0
  protected void store() {
    Preferences prefs = getPreferences();

    // clear the backing store
    try {
      prefs.clear();
    } catch (BackingStoreException ex) {
    }

    for (int i = 0; i < gradients.size(); i++) {
      LinearGradient gradient = gradients.get(i);
      try {
        prefs.putByteArray(COLORS + i, serializeColors(gradient.getColors()));
        prefs.putByteArray(POSITIONS + i, serializePositions(gradient.getPositions()));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }