title: Why the item selected return nothing when it was called?
body: <p>I'm trying to create a Request Responses activity and get the itemSelected for use of next activity which is store them into user friendlist. But the itemSelected return nothing when the "Accept" button is clicked.(It should display itemSelected in toast dialog) Anyone knows what happen it is? Additionally, I like to ask why the item in the listView was located at the not accurate location? it seems like more upper that usual, for the second item.How to adjust it properly?</p>
  
  <p>The figure below is layout of NotificationView.java:</p>
  
  <p><img src="https://i.stack.imgur.com/UFPGj.png" alt="The result when the &quot;Accept&quot; button is clicked."></p>
  
  <p>NotificationView.java</p>
  
  <pre><code>public class NotificationView extends ListActivity{
  
  String[] people;
  ListView lv;
  Button btn1,btn2;
  
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.view);  
      NotificationManager mnotis =(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
      mnotis.cancel(getIntent().getExtras().getInt("notificationID"));
      String i = getIntent().getExtras().getString("name");
      people = i.split("[,]");
      Log.d("how",i);
  
      lv= (ListView) findViewById(android.R.id.list);
      btn1 = (Button)findViewById(R.id.acceptbtn);
      btn2 = (Button)findViewById(R.id.closebtn);
      ArrayAdapter&lt;String&gt; list = new ArrayAdapter&lt;String&gt;(NotificationView.this,R.layout.friendlist_item, R.id.friend_name,people);
      lv.setAdapter(list); 
  
      btn1.setOnClickListener(new View.OnClickListener()
      {
          public void onClick(View v)
          {
              lv = getListView();
              int i = lv.getCount();
              Log.d("count",String.valueOf(i));
              runOnUiThread(new Runnable(){
                  public void run(){
                      String itemSelected = "Selected items: \n";
                      for(int i=0;i&lt;lv.getCount();i++){
                          if(lv.isItemChecked(i)){
                              itemSelected += lv.getItemAtPosition(i) + "\n";
                          }
                      }
                      Toast.makeText(NotificationView.this,itemSelected,Toast.LENGTH_SHORT).show();
                  }               
              });
  
          }
      });
  }}      
  </code></pre>
  
  <p>view.xml</p>
  
  <pre><code>  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    &gt;
  
  &lt;ListView android:id="@android:id/list" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"&gt;
  &lt;/ListView&gt;
  
  &lt;FrameLayout android:id="@+id/FrameLayout01" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"&gt;
  
  
    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="#ffffff"
        android:orientation="horizontal" &gt;
  
  
        &lt;Button
            android:id="@+id/acceptbtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="0.46"
            android:text="Accept" /&gt;
  
  
  
        &lt;Button
            android:id="@+id/closebtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.49"
            android:text="Close" /&gt;
  
    &lt;/LinearLayout&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>friendlist_item.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;CheckBox android:id="@+id/friend_name"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:paddingRight = "88dip"
  android:textSize="20dip"
  android:textStyle="bold"/&gt;  
  
  &lt;/LinearLayout&gt;
  </code></pre>