View Single Post
Old 09-02-2009, 01:42 AM   #1
Shreyas
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Question Problem in saving a Bitmap image in Blackberry Storm 9500.

Please Login to Remove!

Hi all,

I m saving Bitmap image like..

Code:
private void saveBitmap(int picIndex, Bitmap bmp) 
{
   try
   {
     String PHOTO_DIR = System.getProperty ("fileconn.dir.photos"); 
     String EXTENSION = ".bmp";
     String filePath = PHOTO_DIR + picIndex + EXTENSION;
     
     FileConnection fconn = (FileConnection)Connector.open(filePath, 
                                   Connector.READ_WRITE); 

     if(!fconn.exists())
         fconn.create();

     OutputStream outputStream = fconn.openOutputStream();
     
     // bitmap to byte array conversion    
     PNGEncoder encoder = new PNGEncoder(bmp, true);
     byte[] bitmapBuffer = encoder.encode(true);
            
     outputStream.write(bitmapBuffer);
     outputStream.close();
     fconn.close();
  }
  catch(Exception e)
  {
     System.out.println("  Exception while saving Bitmap:: 
                "+e.toString());
     e.getMessage();
  }
}
, the bimap is saved in Media->Pictures->Pictures Folder->1.bmp

but when clicked on it to view, error comes on console as

Code:
Unable to create EncodedImage for: /store/home/user/pictures/1.bmp
I m working in Blackberry JDE 4.7.0.41 & tested in Blackberry 9500, 9530 Simulators & Strom 9500 device but its not working. The same above problem is coming.

Not getting what may be the problem. Plz suggest.
Offline   Reply With Quote