how to give setonitemclick listener condition in customized listview from server database
<p>i am fetching the images and text from database in a customized listview.now i can click text means it navigate another page . now i want setonitemclicklistener of listview depends up on the code it navigate from one page to another page
 Main.java</p>

<pre><code>           JSONArray json = jArray.getJSONArray("mainmenu");
    list=(ListView)findViewById(R.id.mainmenulist);
     adapter=new MainMenulist(this, json);
     list.setAdapter(adapter);
</code></pre>

<p>here i try like this</p>

<pre><code>           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.contains("1"))

            {
            Intent intent=new Intent(getApplicationContext(),FoodMenu.class);
            startActivity(intent);
            }else
            {

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

<p>the above code navigate all pages but code=1 means navigate one page not means navigate another page ..please help me</p>

<p>MainMenulist.java</p>

<pre><code>             public class MainMenulist extends BaseAdapter {
protected static Context Context = null;
int i;
public String editnewmainmenu,menuname;
String qrimage;
Bitmap bmp, resizedbitmap;
Bitmap[] bmps;
Activity activity = null;
private LayoutInflater inflater;

private ImageView[] mImages;
String[] itemimage;
TextView[] tv;
String itemname,itemcode;
public String[] itemnames,itemcodes;
HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();

public MainMenulist(Context context, JSONArray imageArrayJson) {
    Context = context;
    // inflater =
    // (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // imageLoader=new ImageLoader(activity);
    inflater = LayoutInflater.from(context);
    this.mImages = new ImageView[imageArrayJson.length()];
    this.bmps = new Bitmap[imageArrayJson.length()];
    this.itemnames = new String[imageArrayJson.length()];
    this.itemcodes=new String[imageArrayJson.length()];

    try {

        for (i = 0; i &lt; imageArrayJson.length(); i++) {
            JSONObject image = imageArrayJson.getJSONObject(i);
            qrimage = image.getString("menuimage");
            itemname = image.getString("menuname");
            itemcode=image.getString("menucode");
            itemnames[i] = itemname;
            itemcodes[i]=itemcode;

            byte[] qrimageBytes = Base64.decode(qrimage.getBytes());

            bmp = BitmapFactory.decodeByteArray(qrimageBytes, 0,
                    qrimageBytes.length);
            int width = 100;
            int height = 100;
            resizedbitmap = Bitmap.createScaledBitmap(bmp, width, height,
                    true);
            bmps[i] = bmp;

            mImages[i] = new ImageView(context);
            mImages[i].setImageBitmap(resizedbitmap);

            mImages[i].setScaleType(ImageView.ScaleType.FIT_START);

            // tv[i].setText(itemname);
        }
        System.out.println(itemnames[i]);
        System.out.println(map);

    } catch (Exception e) {
        // TODO: handle exception
    }
}

public int getCount() {
    return mImages.length;
}

public Object getItem(int position) {
    return position;
}

public long getItemId(int position) {
    return position;
}

public View getView(final int position, View convertView, ViewGroup parent) {

    View vi = convertView;

    vi = inflater.inflate(R.layout.mainmenulistview, null);

final   TextView text = (TextView) vi.findViewById(R.id.menutext);
    ImageView image = (ImageView) vi.findViewById(R.id.menuimage);

    System.out.println(itemcodes[position]);
    image.setImageBitmap(bmps[position]);

    text.setText(itemnames[position]);
    text.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            if(itemcodes[position].equals("1"))
            {
                Intent intent = new Intent(Context, FoodMenu.class);
                System.out.println("prakash");

                Context.startActivity(intent);
            }
            else {
                Toast.makeText(Context, "This Feauture is not yet Implemented",4000).show();
            }

        }
    });       

    return vi;

}

 }
</code></pre>

<p>in the above class works fine when the click text means code=1 means it goes to another page. how can i give same thing list view setonitemclick listiner</p>
