Button in different position list view when click should display different toast at different position
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10640077/button-in-list-view-when-click-should-display-different-toast-at-different-posit">Button in list view when click should display different toast at different position</a>  </p>
</blockquote>



<p>This is my <code>appointmentlist xml file</code> which contain listview,textview,image button and buttons as shown below.</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="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" &gt;

        &lt;TextView
            android:id="@+id/txtselectedcalenderdate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="" /&gt;

            &lt;ListView
                android:id="@+id/listtimings"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" &gt;
            &lt;/ListView&gt;

            &lt;LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" &gt;

                &lt;TextView
                    android:id="@+id/txttimings"
                    android:layout_width="wrap_content"
                    android:layout_height="36dp"
                    android:text="" &gt;
                &lt;/TextView&gt;

                &lt;Button
                    android:id="@+id/buttonddd"
                    android:layout_width="170dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:clickable="true"
                    android:onClick="recoder"
                    android:text="Recoder" &gt;
                &lt;/Button&gt;

                &lt;ImageButton
                    android:id="@+id/imageButton1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="spilter"
                    android:src="@drawable/icon" &gt;
                &lt;/ImageButton&gt;
            &lt;/LinearLayout&gt;
        &lt;/LinearLayout&gt;
</code></pre>

<p>This is my <code>java appointmentlist class</code>. Here i have already make clickable at the button and imagebutton and it is also displaying the Toast. But the problem i am facing is that the list view has different position and at each position there are image button and button.I want different listview position buttons should display diffrent toast when i click to that buttons and image button. I Google many tutorial but i am not getting how to implement.</p>

<pre><code>public class appointmentlist extends Activity {
    ListView lv;
    TextView selected_calender_date_display;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.appoitmentlist);
        Intent i=getIntent();
        Bundle b=i.getExtras();
        String selected_calender_date=b.getString("selected_calender_date");
        selected_calender_date_display=(TextView) findViewById(R.id.txtselectedcalenderdate);
        selected_calender_date_display.setText(selected_calender_date);
        lv = (ListView) findViewById(R.id.listtimings);
        String[] values = {"08AM\n09AM","09AM\n10AM", "10AM\n11AM", "11AM\n12AM", "12PM\n01PM",
                "01PM\n02PM", "02PM\n03PM", "03PM\n04PM", "04PM\n05PM",
                "05PM\n06PM", "06PM\n07PM", "07PM\n08PM", "08PM\n09PM", "09PM\n10PM" };
        ListAdapter adapter = new ArrayAdapter&lt;String&gt;(this,
                R.layout.appoitmentlist, R.id.txttimings, values);
        lv.setAdapter(adapter);
            }

    public void recoder(View v)
    {
        Toast.makeText(this, "joo", 100).show();
    }

    public void spilter(View v)
    {
        Toast.makeText(this, "Spliter", 100).show();
    }
}
</code></pre>
