| android Programming Glossary: samplesizeCreate video from screen grabs in android http://stackoverflow.com/questions/14067339/create-video-from-screen-grabs-in-android  encoder.queueInputBuffer inputBufIndex 0 offset  sampleSize presentationTimeUs 0 int outputBufIndex encoder.dequeueOutputBuffer.. 
 How to downscale images correctly? http://stackoverflow.com/questions/16408505/how-to-downscale-images-correctly  int originalWidth options.outWidth Calculate your sampleSize based on the requiredWidth and originalWidth For e.g you want.. 500 getResources .getDisplayMetrics .density int sampleSize originalWidth requiredWidth If the original image is smaller.. original image is smaller than required don't sample if sampleSize 1 sampleSize 1 options.inSampleSize sampleSize options.inPurgeable.. 
 BitmapFactory.decodeStream returning null when options are set http://stackoverflow.com/questions/2503628/bitmapfactory-decodestream-returning-null-when-options-are-set  power of 2 that'll get it desired dimensions double sampleSize scaleByHeight options.outHeight TARGET_HEIGHT options.outWidth.. options.inSampleSize int Math.pow 2d Math.floor Math.log sampleSize Math.log 2d Do the actual decoding options.inJustDecodeBounds.. power of 2 that'll get it desired dimensions double sampleSize scaleByHeight  options.outHeight TARGET_HEIGHT  options.outWidth.. 
 Decoding bitmaps in Android with the right size http://stackoverflow.com/questions/2641726/decoding-bitmaps-in-android-with-the-right-size  int newWidth calculateNewWidth int width int height float sampleSizeF float width float newWidth int sampleSize Math.round sampleSizeF.. height float sampleSizeF float width float newWidth int sampleSize Math.round sampleSizeF BitmapFactory.Options resample new BitmapFactory.Options.. float width float newWidth int sampleSize Math.round sampleSizeF BitmapFactory.Options resample new BitmapFactory.Options resample.inSampleSize.. 
 Android audio FFT to retrieve specific frequency magnitude using audiorecord http://stackoverflow.com/questions/5774104/android-audio-fft-to-retrieve-specific-frequency-magnitude-using-audiorecord  int format AudioFormat.ENCODING_PCM_16BIT int sampleSize 8000 int bufferSize AudioRecord.getMinBufferSize sampleSize.. 8000 int bufferSize AudioRecord.getMinBufferSize sampleSize channel_config format AudioRecord audioInput new AudioRecord.. AudioRecord audioInput new AudioRecord AudioSource.MIC sampleSize channel_config format bufferSize The audio is then read in short.. 
 How to implement Image Gallery in Gridview in android? http://stackoverflow.com/questions/6855399/how-to-implement-image-gallery-in-gridview-in-android  power of 2 that'll get it desired dimensions double sampleSize scaleByHeight options.outHeight 100 options.outWidth 100 options.inSampleSize.. options.inSampleSize  int Math.pow 2d Math.floor Math.log sampleSize Math.log 2d  Do the actual decoding options.inJustDecodeBounds.. 
 How to convert the WAV/OGG file to FLAC file in Android? http://stackoverflow.com/questions/9733064/how-to-convert-the-wav-ogg-file-to-flac-file-in-android    int sampleRate 16000 int format.getSampleRate   int sampleSize 16 int format.getSampleSizeInBits   int channels 1 int format.getChannels.. channels blockSize blockSize   sampleRate sampleSize   sc.setSampleRate sampleRate   sc.setBitsPerSample sampleSize..   sc.setSampleRate sampleRate   sc.setBitsPerSample sampleSize   sc.setChannelCount channels       Set the stream configuration.. 
 Create video from screen grabs in android http://stackoverflow.com/questions/14067339/create-video-from-screen-grabs-in-android  2 j 2 stride sliceHeight 5 4 ... V i j   inputBuf.put inputFrame encoder.queueInputBuffer inputBufIndex 0 offset  sampleSize presentationTimeUs 0 int outputBufIndex encoder.dequeueOutputBuffer info timeout if outputBufIndex 0 ByteBuffer outputBuf.. 
 How to downscale images correctly? http://stackoverflow.com/questions/16408505/how-to-downscale-images-correctly  file.getAbsolutePath options int originalHeight options.outHeight int originalWidth options.outWidth Calculate your sampleSize based on the requiredWidth and originalWidth For e.g you want the width to stay consistent at 500dp int requiredWidth 500.. e.g you want the width to stay consistent at 500dp int requiredWidth 500 getResources .getDisplayMetrics .density int sampleSize originalWidth requiredWidth If the original image is smaller than required don't sample if sampleSize 1 sampleSize 1 options.inSampleSize.. .density int sampleSize originalWidth requiredWidth If the original image is smaller than required don't sample if sampleSize 1 sampleSize 1 options.inSampleSize sampleSize options.inPurgeable true options.inPreferredConfig Bitmap.Config.RGB_565.. 
 BitmapFactory.decodeStream returning null when options are set http://stackoverflow.com/questions/2503628/bitmapfactory-decodestream-returning-null-when-options-are-set  options.outWidth 2 200 100 2 Load scaling to smallest power of 2 that'll get it desired dimensions double sampleSize scaleByHeight options.outHeight TARGET_HEIGHT options.outWidth TARGET_WIDTH options.inSampleSize int Math.pow 2d Math.floor.. options.outHeight TARGET_HEIGHT options.outWidth TARGET_WIDTH options.inSampleSize int Math.pow 2d Math.floor Math.log sampleSize Math.log 2d Do the actual decoding options.inJustDecodeBounds false Bitmap img BitmapFactory.decodeStream is null options.. options.outWidth 2 200 200 2 Load scaling to smallest power of 2 that'll get it desired dimensions double sampleSize scaleByHeight  options.outHeight TARGET_HEIGHT  options.outWidth TARGET_WIDTH options.inSampleSize  int Math.pow 2d Math.floor.. 
 Decoding bitmaps in Android with the right size http://stackoverflow.com/questions/2641726/decoding-bitmaps-in-android-with-the-right-size  withinBounds width maxWidth height maxHeight if withinBounds int newWidth calculateNewWidth int width int height float sampleSizeF float width float newWidth int sampleSize Math.round sampleSizeF BitmapFactory.Options resample new BitmapFactory.Options.. if withinBounds int newWidth calculateNewWidth int width int height float sampleSizeF float width float newWidth int sampleSize Math.round sampleSizeF BitmapFactory.Options resample new BitmapFactory.Options resample.inSampleSize sampleSize bitmap.. newWidth calculateNewWidth int width int height float sampleSizeF float width float newWidth int sampleSize Math.round sampleSizeF BitmapFactory.Options resample new BitmapFactory.Options resample.inSampleSize sampleSize bitmap BitmapFactory.decodeFile.. 
 Android audio FFT to retrieve specific frequency magnitude using audiorecord http://stackoverflow.com/questions/5774104/android-audio-fft-to-retrieve-specific-frequency-magnitude-using-audiorecord  class int channel_config AudioFormat.CHANNEL_CONFIGURATION_MONO int format AudioFormat.ENCODING_PCM_16BIT int sampleSize 8000 int bufferSize AudioRecord.getMinBufferSize sampleSize channel_config format AudioRecord audioInput new AudioRecord.. int format AudioFormat.ENCODING_PCM_16BIT int sampleSize 8000 int bufferSize AudioRecord.getMinBufferSize sampleSize channel_config format AudioRecord audioInput new AudioRecord AudioSource.MIC sampleSize channel_config format bufferSize.. AudioRecord.getMinBufferSize sampleSize channel_config format AudioRecord audioInput new AudioRecord AudioSource.MIC sampleSize channel_config format bufferSize The audio is then read in short audioBuffer new short bufferSize audioInput.startRecording.. 
 How to implement Image Gallery in Gridview in android? http://stackoverflow.com/questions/6855399/how-to-implement-image-gallery-in-gridview-in-android  options.outWidth 2 16384 Load scaling to smallest power of 2 that'll get it desired dimensions double sampleSize scaleByHeight options.outHeight 100 options.outWidth 100 options.inSampleSize  int Math.pow 2d Math.floor Math.log sampleSize.. scaleByHeight options.outHeight 100 options.outWidth 100 options.inSampleSize  int Math.pow 2d Math.floor Math.log sampleSize Math.log 2d  Do the actual decoding options.inJustDecodeBounds false options.inTempStorage new byte 512 Bitmap output BitmapFactory.decodeFile.. 
 How to convert the WAV/OGG file to FLAC file in Android? http://stackoverflow.com/questions/9733064/how-to-convert-the-wav-ogg-file-to-flac-file-in-android  val     private void adjustConfigurations AudioFormat format   int sampleRate 16000 int format.getSampleRate   int sampleSize 16 int format.getSampleSizeInBits   int channels 1 int format.getChannels   int blockSize sc.getMaxBlockSize   sc new StreamConfiguration..   int blockSize sc.getMaxBlockSize   sc new StreamConfiguration channels blockSize blockSize   sampleRate sampleSize   sc.setSampleRate sampleRate   sc.setBitsPerSample sampleSize   sc.setChannelCount channels       Set the stream configuration.. channels blockSize blockSize   sampleRate sampleSize   sc.setSampleRate sampleRate   sc.setBitsPerSample sampleSize   sc.setChannelCount channels       Set the stream configuration for this encoder to use. Note that the audio   characteristics.. 
 Choosing background for Live Wallpaper http://stackoverflow.com/questions/3679330/choosing-background-for-live-wallpaper  0 this.visibleWidth 0  this.cvwidth 480  this.cvheight 854  this.visibleWidth 480 if new File imageBg .exists  int SampleSize 1 do  BitmapFactory.Options options new BitmapFactory.Options  options.inJustDecodeBounds true  bg BitmapFactory.decodeFile.. options new BitmapFactory.Options  options.inJustDecodeBounds true  bg BitmapFactory.decodeFile imageBg options  SampleSize int Math.ceil options.outWidth this.visibleWidth 2 2  options.inJustDecodeBounds false  try options.inSampleSize SampleSize..  SampleSize int Math.ceil options.outWidth this.visibleWidth 2 2  options.inJustDecodeBounds false  try options.inSampleSize SampleSize  bg BitmapFactory.decodeFile imageBg options  catch OutOfMemoryError e  SampleSize SampleSize 2   while bg null.. 
 Android: high quality image resizing / scaling http://stackoverflow.com/questions/4207562/android-high-quality-image-resizing-scaling  stream without losing quality. I am aware of this solution Android Strange out of memory issue but it is too coarse inSampleSize is an integer and does not allow finer control over the resulting dimensions. That is I need to scale images to specific.. int scaleWidth int bm.getWidth scale int scaleHeight int bm.getHeight scale  original image is 720x402 and SampleSize 4 produces 180x102 which is still too large BitmapFactory.Options bfo new BitmapFactory.Options bfo.inSampleSize 4 return.. and SampleSize 4 produces 180x102 which is still too large BitmapFactory.Options bfo new BitmapFactory.Options bfo.inSampleSize 4 return BitmapFactory.decodeResource getResources R.drawable.a000001570402 bfo  And the layout xml version 1.0 encoding.. 
 |