Пример #1
0
  private void saveToSdcard() {
    GlobalVariables g = GlobalVariables.getInstance();
    String fullPath =
        g.getUserHomePath()
            + "userdata/"
            + g.getSubject()
            + "/"
            + g.getCollectname()
            + g.getDirectory()
            + "/UserPaint/"
            + Integer.toString(((CheckContext) context).GetCurrentPage())
            + ".png";

    File f = new File(fullPath);
    if (!f.getParentFile().exists()) {
      f.getParentFile().mkdirs();
    }

    if (bitmap != null) {
      try {
        AsyncTask at = new SaveBitmapAsyncTask(Bitmap.createBitmap(bitmap), fullPath);
        at.execute(new Object[] {});
      } catch (Exception e) {
        Toast.makeText(
                context,
                getResources().getString(R.string.tip_sava_failed) + fullPath,
                Toast.LENGTH_SHORT)
            .show();
        e.printStackTrace();
      }
    }
  }
Пример #2
0
 public File GetDraftFilePath() {
   GlobalVariables global = GlobalVariables.getInstance();
   String fullPath =
       GlobalVariables.getInstance().getUserHomePath()
           + "userdata/"
           + global.getSubject()
           + "/"
           + global.getCollectname()
           + global.getDirectory()
           + "/UserPaint/";
   fullPath += Integer.toString(((CheckContext) context).GetCurrentPage());
   fullPath += ".png";
   File f = new File(fullPath);
   return f;
 }