2010-11-20 85 views
-1

我正在做一個程序,你可以在手機上繪製你的簽名。現在它可以保存一張圖片,但我想要保存多張圖片,因爲有多個客戶需要在其包裝上簽名。非常感謝任何形式的幫助。在SD卡中保存多張不同名字的圖片

public void save() { 


      File sdImageMainDirectory = new File("/sdcard/mySignatures"); 
      sdImageMainDirectory.mkdirs(); 

      String nameFile = "newpic"; 

FileOutputStream out = null; 
      try { 

      out = new FileOutputStream(sdImageMainDirectory.toString() +"/" + nameFile + ".jpg"); 

      mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); 
      } catch (Exception e) { 
      e.printStackTrace(); 
      } finally { 
      try { 
       out.flush(); 
      } catch (IOException e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 
      try { 
       out.close(); 
      } catch (IOException e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 
      out=null; 
      } 

回答

3

很明顯,你需要改變文件名爲每個獨特的東西。順序編號將起作用。或者讓用戶輸入一個名稱並驗證其是否合法。