title: How to use setContentView() in Android
body: <p>I have a listview with footer in an activity.</p>
  
  <p>What I want to do is:</p>
  
  <ol>
  <li>Make a listview.</li>
  <li>Add textviews to listview's footer</li>
  <li>Apply footer to listview.</li>
  </ol>
  
  <p>Below is activity's <code>onCreate</code> method</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_lecture_refer_room);
  
      // making listview...
      ListView listView = (ListView) findViewById(R.id.referList);
      ...
      ...
      String[] from = {"line1", "line2"};
      int[] to = {android.R.id.text1, android.R.id.text2};
      SimpleAdapter adapter = new SimpleAdapter(this, mapList,
                android.R.layout.simple_list_item_2, from, to);
  
             // footer_layout is in refer_footer.xml
       View footer = getLayoutInflater().inflate(R.layout.refer_footer, null, false);
      LinearLayout ll = (LinearLayout)findViewById(R.id.footer_layout);
  
      TextView tv= new TextView(this);
      tv.setText(element.text());
      tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                      LayoutParams.WRAP_CONTENT));
      tv.setVisibility(View.VISIBLE);
      ll.addView(tv);
  
  
          listView.addFooterView(footer);
  
          listView.setAdapter(adapter);
          //setContentView(R.layout.activity_lecture_refer_room);
      }
  }
  </code></pre>
  
  <p>Therer are two .xml files.(one for activity that contains listview, one for footer)
  To add textview, I use <code>setContentView(R.layout.refer_footer);</code> and textview was added sucessfully. But when I run a app, it only displays the content of footer.(not listview) So I use <code>setContentView(R.layout.activvity_lecture_refer_room);</code> then app displays nothing. </p>
  
  <p>What should i do to display lsitview containing footer?</p>