ListView onclick not functioning accrodingly
<p>Hi I am using list view in my list view i have veg and non-veg.so when i click on veg it should move to next activity and display the items and when i click on Non-veg it should to next activity.I have written setonclickitemlistener() for both list items but when i press veg  or non-veg it is going to Non-veg activity only.Here is the code</p>

<pre><code>public class MainActivity extends Activity {

String[] items={"veg","non-veg"};


protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

     ListView lv= (ListView)findViewById(R.id.listView1);

  ArrayAdapter&lt;Object&gt; adapter1 = new ArrayAdapter&lt;Object (this,android.R.layout.simple_list_item_1,items);

  lv.setAdapter(adapter1);      

    lv.setOnItemClickListener(new OnItemClickListener() {


        public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int arg2,
                long arg3) {

            {
            Toast.makeText(getBaseContext(),"YOU HAVE SELECTED VEG", 4000).show();
        Intent i=new Intent(MainActivity.this,veg.class);
        startActivity(i);
            }
        }
    });




  lv.setOnItemClickListener(new OnItemClickListener() {         

            public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                    long arg3) {

                Toast.makeText(getBaseContext(),"YOU HAVE SELECTED NON-VEG", 4000).show();
            Intent i=new Intent(MainActivity.this,Nonveg.class);
            startActivity(i);


            }
        });
</code></pre>

<p>}
}</p>

<p>please tell me how to identify id for veg and non veg and how to write setonclicklistener() method.   </p>
