how to give setonitemclick listener condition in listiew
<p>I am fetching the menucode from mysql database to android. if i clicking on item in listview and codez=1 means it navigate to another page else go to another page</p>

<pre><code>      JSONArray json = jArray.getJSONArray("mainmenu");

        final List&lt;String&gt; codez=new ArrayList&lt;String&gt;();
         for ( i = 0; i &lt; json.length(); i++) {

                JSONObject e = json.getJSONObject(i);
                codez.add(e.getString("menucode"));



         }
       list.setOnItemClickListener(new OnItemClickListener() {   

        public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                long arg3) {
            System.out.println(codez);
            // TODO Auto-generated method stub
            if(codez.equals("1"))
            {
            Intent intent=new Intent(getApplicationContext(),FoodMenu.class);
            startActivity(intent);
            }else
            {

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

<p>it prints all codes but not navigate can u please tell me the solution for above code</p>
