title: Android: Error when i try to add view while "setContentView()" not specified
body: <p>the idea is showing list view with icon (each row with different icon). it works perfectly but when i try to add adMob Banner to my view but i get errors "java.lang.NullPointerException".
  When i try to do it with setContentView() it says you must have R.id.list, even if i add a list, same error remains.
  Code:</p>
  
  <p>MainActivity.class</p>
  
  <pre><code>public class MainActivity extends ListActivity {
  
  static final String[] ITEMS = new String[] { "Item1", "Item2",
          "Item3", "Item4"};
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setListAdapter(new HowtoArrayAdapter(this, ITEMS));
      showBanner();
  }
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      String selectedItem = (String) getListAdapter().getItem(position);
      //Toast.makeText(this, selectedItem, Toast.LENGTH_SHORT).show();
  }
  
  public void showBanner(){
      RelativeLayout adContainer = (RelativeLayout) findViewById(R.id.activity_main);
      AdView adView = new AdView(this);
      adView.setAdSize(AdSize.SMART_BANNER);
      adView.setAdUnitId(getString(R.string.banner_ad_unit_id));
  
      AdRequest adRequest = new AdRequest.Builder().build();
      adView.loadAd(adRequest);
  
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
      adContainer.addView(adView, params);
  }}
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;ImageView
          android:id="@+id/logo"
          android:layout_width="70dp"
          android:layout_height="70dp"
          android:layout_marginBottom="5dp"
          android:layout_marginLeft="5dp"
          android:layout_marginRight="5dp"
          android:layout_marginTop="5dp"
          android:src="@drawable/tower" /&gt;
      &lt;TextView
          android:id="@+id/label"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_toRightOf="@id/logo"
          android:paddingLeft="10dp"
          android:paddingTop="21dp"
          android:textSize="26sp" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The Adapter Class:</p>
  
  <pre><code>public class HowtoArrayAdapter extends ArrayAdapter&lt;String&gt; {
      private final Context context;
      private final String[] values;
  
      public HowtoArrayAdapter(Context context, String[] values) {
          super(context, R.layout.activity_main, values);
          this.context = context;
          this.values = values;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View rowView = inflater.inflate(R.layout.activity_main, parent, false);
          TextView textView = (TextView) rowView.findViewById(R.id.label);
          ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
          textView.setText(values[position]);
          //........
          return rowView;
      }
  }
  </code></pre>
  
  <p>Thank you in advance!</p>