Ejemplo n.º 1
0
 public static Bitmap createEmptyBitmap(int w, int h) {
   int newW = SEUtils.higherPower2(w);
   int newH = SEUtils.higherPower2(h);
   Bitmap des = Bitmap.createBitmap(newW, newH, Bitmap.Config.ARGB_8888);
   Canvas canvas = new Canvas(des);
   canvas.drawColor(Color.TRANSPARENT);
   return des;
 }
Ejemplo n.º 2
0
  public static void moveAssetFilesToExternal(Context context, String src, String name) {
    try {
      String localFilePath = getLocalFilePath(context, name);
      String[] filePaths = context.getResources().getAssets().list(src);
      if (filePaths == null) {
        return;
      }
      for (String file : filePaths) {
        InputStream is = context.getResources().getAssets().open(src + File.separator + file);
        File parentFile = new File(localFilePath);
        if (!parentFile.exists()) {
          parentFile.mkdirs();
        }
        File destFile = new File(localFilePath + File.separator + file);
        destFile.createNewFile();
        SEUtils.copyToFile(is, destFile);
        is.close();
      }

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }