| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 
 |  
 Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
        public void onPictureTaken(byte[] data, Camera c) {
            Log.e(TAG, "PICTURE CALLBACK: data.length = " + data.length);
           String imageString = null;
 
            FileOutputStream fOut = null; 
            OutputStreamWriter osw = null;
            ByteArrayOutputStream bos = null;
            try{ 
            	bos = new ByteArrayOutputStream() ;
 
            	Bitmap myPic = BitmapFactory.decodeByteArray( data, 0, data.length );
            	myPic.compress( Bitmap.CompressFormat.JPEG, 100, bos );
 
 
            	myPic = BitmapFactory.decodeByteArray( data, 0, data.length );
            	FileOutputStream stream = openFileOutput( "bobblePic3.jpg", MODE_PRIVATE );
            	myPic.compress( Bitmap.CompressFormat.JPEG, 100,stream );
 
                imageString = new String(bos.toString()); //
                fOut = openFileOutput("bob.jpg",MODE_PRIVATE);  
                osw = new OutputStreamWriter(fOut); 
                osw.write(imageString); 
                osw.flush();
                fOut.close();
                osw.close();
                bos.close();
 
            } 
            catch (Exception e) {       
            	Log.e("error", e.toString());
            } 
        }
    }; | 
Partager