title: How to add button in List View?
body: <p>I am trying to add button in listview. How to do this?</p>
  
  <p>My code and xml file are as follows:</p>
  
  <pre><code>public class Second extends ListActivity {
  Button btn;
  ListView lst;
      @Override
      protected void onCreate(Bundle abc) {
          // TODO Auto-generated method stub
          super.onCreate(abc);
          setContentView(R.layout.nit);
          lst=getListView();
          lst.setAdapter(new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_list_item_1,WORLDCUP2010));
  
  
          btn=(Button)findViewById(R.id.button1);
          btn.setOnClickListener(new View.OnClickListener() {
  
  
               public void onClick(View v) {
                  Intent i=new Intent(Second.this,Fifth.class);
                  startActivity(i);
  
               }});
  
      }
      static final String[] WORLDCUP2010 = new String[] {
          "Citrzen",  "Disprine", "Gelosil", 
          "", "", "", 
          "", "", "", 
           };
  }
  </code></pre>
  
  <p>and the xml is as follows,</p>
  
  <pre><code>LinearLayout android:id="@+id/linearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical"
  LinearLayout 
      android:orientation="vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent" android:padding="3dp"
      Button android:background="@drawable/med"
          android:layout_gravity="center" android:id="@+id/button1"
          android:layout_width="wrap_content" android:layout_height="wrap_content"
  /Button
      ListView android:layout_height="wrap_content" android:id="@+android:id/listView1"
          android:layout_width="fill_parent" android:layout_weight="1"
  /ListView
  
  /LinearLayout
  /LinearLayout
  </code></pre>