2011-03-02 130 views

回答

1

您將需要獲取圖像的字節,然後使用OutputStream將它們寫入磁盤。像這樣的東西

FileConnection imageFile = null;; 
    byte[] rawData = encodedImage.getData(); 
    try{ 
     //You can change the folder location on the SD card if you want 
     imageFile = (FileConnection) Connector.open("file:///SDCard/BlackBerry/images"+filename); 
     if(!imageFile.exists()){ 
      imageFile.create(); 
     } 

     //Write raw data 
     OutputStream outStream = imageFile.openOutputStream(); 
     outStream.write(rawData); 
     outStream.close(); 
     imageFile.close(); 
    } catch(IOException ioe){ 
     //handle exception 
    } finally { 
     try{ 
      if(imageFile != null){ 
       imageFile.close(); 
      } 
     } catch(IOException ioe){ 

     } 
    } 
相關問題