2011-03-02 133 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){ 

     } 
    } 
相关问题