Android Media Recorder will stop functioning and show a Java.lang.RuntimeException if we provide a very small file size, for example if you will put 1024 as the MediaRecorder.setMaxFileSize parameter, the recording won't even start in the first place. Remember, the number provided as input to this method represents maximum number of bytes which would be stored in a file by the MediaRecorder.
The reason is that it takes almost 10 KB to store a audio recording of 1 second or so. When you will put 1024 bytes as a parameter, the MediaRecord will simple run out of space when it will try to stop the voice recording upon reaching the tiny number 1024 bytes. The error code returned by such a situation is -22, and the logging line will look something like the one given below:
Wednesday, September 4, 2013
Wednesday, March 20, 2013
Determining percentage of colors in a bitmap using C# without getPixel
To keep things simple, let's suppose we have a black and white bitmap image.
I will not use getPixel method here, Bitmap.getPixel() is a very expensive method, and it alone can turn your program into a lazy snail.
Please note that I am using a Format24bpprgb image format here, 24BPPRGB can be defined as:
Each pixel in the image is represented by 24 bits. First 8 bits represent red color, next 8 bits represent green color, and last 8 bits represent blue color in a bitmap.
Another popular format is 32BPPARGB, in this format the first 8 bits represent "Alpha" or the opacity of pixel, next 3 bytes or 24 bits describe the RGB components same like 24BPPRGB.
Given below is the C# language source code for checking pixel colors without Bitmap.getPixel() method.
I will not use getPixel method here, Bitmap.getPixel() is a very expensive method, and it alone can turn your program into a lazy snail.
Please note that I am using a Format24bpprgb image format here, 24BPPRGB can be defined as:
Each pixel in the image is represented by 24 bits. First 8 bits represent red color, next 8 bits represent green color, and last 8 bits represent blue color in a bitmap.
Another popular format is 32BPPARGB, in this format the first 8 bits represent "Alpha" or the opacity of pixel, next 3 bytes or 24 bits describe the RGB components same like 24BPPRGB.
Given below is the C# language source code for checking pixel colors without Bitmap.getPixel() method.
Subscribe to:
Posts (Atom)