title: Why does this view not display in emulator?
body: <p>I have a feeling this may be a noob question, so please bear with me if so.</p>
  <p>My code executes OK, but nothing is displayed in the emulator.  I thought I had created a programmatic view using the below code, but it doesn't seem to generate.</p>
  <pre><code>        package com.example.trimmer_test;
  
  import android.app.Activity;
  import android.content.res.Resources;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  
  
  public class Trimmer extends Activity {
      public Bitmap img1;
  
      public static Bitmap TrimBitmap(Bitmap bmp) {
          int imgHeight = bmp.getHeight();
          int imgWidth = bmp.getWidth();
  
  
          //TRIM WIDTH - LEFT
          int startWidth = 0;
          for (int x = 0; x &lt; imgWidth; x++) {
              if (startWidth == 0) {
                  for (int y = 0; y &lt; imgHeight; y++) {
                      if (bmp.getPixel(x, y) != Color.TRANSPARENT) {
                          startWidth = x;
                          break;
                      }
                  }
              } else break;
          }
  
  
          //TRIM WIDTH - RIGHT
          int endWidth = 0;
          for (int x = imgWidth - 1; x &gt;= 0; x--) {
              if (endWidth == 0) {
                  for (int y = 0; y &lt; imgHeight; y++) {
                      if (bmp.getPixel(x, y) != Color.TRANSPARENT) {
                          endWidth = x;
                          break;
                      }
                  }
              } else break;
          }
  
  
          //TRIM HEIGHT - TOP
          int startHeight = 0;
          for (int y = 0; y &lt; imgHeight; y++) {
              if (startHeight == 0) {
                  for (int x = 0; x &lt; imgWidth; x++) {
                      if (bmp.getPixel(x, y) != Color.TRANSPARENT) {
                          startHeight = y;
                          break;
                      }
                  }
              } else break;
          }
  
  
          //TRIM HEIGHT - BOTTOM
          int endHeight = 0;
          for (int y = imgHeight - 1; y &gt;= 0; y--) {
              if (endHeight == 0) {
                  for (int x = 0; x &lt; imgWidth; x++) {
                      if (bmp.getPixel(x, y) != Color.TRANSPARENT) {
                          endHeight = y;
                          break;
                      }
                  }
              } else break;
          }
  
  
          return Bitmap.createBitmap(
                  bmp,
                  startWidth,
                  startHeight,
                  endWidth - startWidth,
                  endHeight - startHeight
          );
  
      }
  
      private final Resources res;
  
      public Trimmer(final Resources res) {
          this.res = res;
      }
  
      public void My_Bitmap2() {
          Bitmap my_bitmap2 = BitmapFactory.decodeResource(this.res, R.drawable.my_bitmap2);
          Bitmap img1 = TrimBitmap(my_bitmap2);
  
      }
  
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          LinearLayout ll = new LinearLayout(this);
          ll.setOrientation(LinearLayout.VERTICAL);
          ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
          ImageView IV1 = new ImageView(this);
          IV1.setImageBitmap(img1);
          setContentView(ll);
  
      }}
  </code></pre>
  <p>And the Manifest XML file is:</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.example.trimmer_test&quot;&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:icon=&quot;@mipmap/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
          android:supportsRtl=&quot;true&quot;
          android:theme=&quot;@style/AppTheme&quot;&gt;
          &lt;activity android:name=&quot;.Trimmer&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  </code></pre>
  <p>The view doesn't appear when launched at all.</p>