how to print all values print outside the loop in android
<p>I can fetch the menucode from database i can print inside for loop means it prints all menucodes. if i print loop out side means it print only last value</p>

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

         for ( i = 0; i &lt; json.length(); i++) {

                JSONObject e = json.getJSONObject(i);
            map.put("itemcode", e.getString("menucode"));   //here i print all values  


         }
      list.setOnItemClickListener(new OnItemClickListener() {   

        public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                long arg3) {
            System.out.println(map.get("itemcode"));//here i print only last value(here i want print all values how can i do this)
            // TODO Auto-generated method stub
            Intent intent=new Intent(getApplicationContext(),FoodMenu.class);
            startActivity(intent);
        }
    });
</code></pre>

<p>out side for loop also i want print all menucodes .. please help me</p>
