title: Dynamically adding Thumbnail in android
body: <p>i am trying to add a thumbnail dynamically to my relative layout. This is code here</p>
  
  <pre><code>public void showViewOfReceipt(String fileName)
           {
               byte[] imageData = null;
  
               try
               {
  
               final int THUMBNAIL_SIZE = 64;
  
               FileInputStream fis = new FileInputStream(fileName);
               Bitmap imageBitmap = BitmapFactory.decodeStream(fis);
  
               Float width = new Float(imageBitmap.getWidth());
               Float height = new Float(imageBitmap.getHeight());
               Float ratio = width/height;
               imageBitmap = Bitmap.createScaledBitmap(imageBitmap, (int)(THUMBNAIL_SIZE * ratio), THUMBNAIL_SIZE, false);
  
               ByteArrayOutputStream baos = new ByteArrayOutputStream();
               imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
               imageData = baos.toByteArray();
               ImageView image = new ImageView(this); 
  
               image.setImageBitmap(imageBitmap);
               RelativeLayout layout = (RelativeLayout) findViewById(R.id.expLayout5);
               layout.addView(image); 
               }
               catch(Exception ex) {
               } 
           }
  </code></pre>
  
  <p>It never shows anything</p>
  
  <p>Regards</p>