code: public void save() {
          FileWriter fw = null;
          BufferedWriter bw = null;
          try {
              fw = new FileWriter(file);
              bw = new BufferedWriter(fw);
              for (Iterator<Object> iterator = ini.keySet().iterator(); iterator.hasNext(); ) {
                  String key = iterator.next().toString();
                  bw.write(key + "=" + getKey(key));
                  bw.newLine();
              }
              bw.close();
              bw = null;
              fw.close();
              fw = null;
          } catch (Exception ex) {
              Log.e(TAG, "", ex);
          } finally {
              if (bw != null) {
                  try {
                      bw.close();
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
                  bw = null;
              }
              if (fw != null) {
                  try {
                      fw.close();
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
                  fw = null;
              }
  
          }
      }
docs: save the file.