Esempio n. 1
0
  public static boolean SAVE_PROP(Properties p, String filename) {
    if (PATH == null) {
      INIT_PROP();
    }
    try {
      FileOutputStream out =
          MainApplication.getContext()
              .openFileOutput(filename + ".properties", MainApplication.getContext().MODE_PRIVATE);
      p.store(out, "");

      return true;
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }
Esempio n. 2
0
  public static Properties LOAD_PROP(String filename) {
    if (PATH == null) {
      INIT_PROP();
    }
    try {
      Properties prop = new Properties();
      File file = new File(PATH + filename + ".properties");
      if (!file.exists()) {
        FileOutputStream out =
            MainApplication.getContext()
                .openFileOutput(filename + ".properties", MainApplication.getContext().MODE_APPEND);
        out.close();
      }
      FileInputStream fis = MainApplication.getContext().openFileInput(filename + ".properties");
      prop.load(fis);

      return prop;
    } catch (IOException e) {
      e.printStackTrace();
      return null;
    }
  }