title: how to retrieve json nested array datas and populate into listview?
body: <ol>
  <li>Get Json Nested array datas into Arraylist.</li>
  <li>Populate it into List View</li>
  <li>Had Spinner also, whenever spinner data changes List view datas also changes..</li>
  </ol>
  
  <p>Is this possible to do in android?</p>
  
  <pre><code>{
    "Topping": [
      {
        "topping_id": 1,
        "topping_title": "title_1",
        "topping_price": 1,
        "Foods": [
          {
            "price": 1,
            "lable": "price_1"
          },
          {
            "price": 1.5,
            "lable": "price_2"
          },
          {
            "price": 2,
            "lable": "price_3"
          }
        ]
      },
      {
        "topping_id": 2,
        "topping_title": "title_2",
        "topping_price": 1,
        "Foods": [
          {
            "price": 1,
            "lable": "price_1"
          },
          {
            "price": 1.5,
            "lable": "price_2"
          },
          {
            "price": 2,
            "lable": "price_3"
          }
        ]
      },
      {
        "topping_id": 3,
        "topping_title": "title_3",
        "topping_price": 1,
        "Foods": [
          {
            "price": 1,
            "lable": "price_1"
          },
          {
            "price": 1.5,
            "lable": "price_2"
          },
          {
            "price": 2,
            "lable": "price_3"
          }
        ]
      }
    ],
    "Food_sizes": [
      {
        "price": 10,
        "lable": "10\" SML",
        "size": "price_1"
      },
      {
        "price": 12,
        "lable": "14\" MED",
        "size": "price_2"
      },
      {
        "price": 14,
        "lable": "16\" LRG",
        "size": "price_3"
      }
    ]
  }
  </code></pre>
  
  <p>This is my json format and <code>Food_Sizes</code> array i want to display into Spinner(Single Select)...    Food price and its name want to display into listview...  whenever spinner value changes price of list view value also changes... 
  My Code for getting this data...</p>
  
  <pre><code>stringtoppingcombo = new ArrayList&lt;&gt;();
  string_spinner_size = new ArrayList&lt;&gt;();
  try {
      List&lt;NameValuePair&gt; request_topping = new ArrayList&lt;NameValuePair&gt;();
      request_topping.add(new BasicNameValuePair("food_id", title_id));
      JSONObject jobject = jparser.makeHttpRequest(GET_TOPPING, "POST", request_topping);
      jarray1 = jobject.getJSONArray("Topping");
          for(int i=0; i&lt;jarray1.length();i++) {
          JSONObject jobjet = jarray1.getJSONObject(i);
          ToppingCombo item = new ToppingCombo(); 
          item.setTOPPINGID(jobjet.getInt("topping_id"));
          item.setTOPPINGTITLE(jobjet.getString("topping_title"));
          item.setTOPPINGPRICE(Float.parseFloat(jobjet.getString("topping_price")));
          JSONArray food_array = jobjet.getJSONArray("Foods");
          for (int k=0; k &lt; food_array.length(); k++) {
              JSONObject food_object = food_array.getJSONObject(k);
                  Food_Topping_Items_Sizes items_size = new Food_Topping_Items_Sizes();
                  items_size.setPriceTopping(Float.parseFloat(food_object.getString("price")));
                  items_size.setLabelTopping(food_object.getString("lable"));
                      item.setFoodItems(items_size);
          }
          toppingcomboitem.add(item);
      }
      jsonarray= jobject.getJSONArray("Food_sizes");
      for(int j=0; j &lt; jsonarray.length(); j++) {
          JSONObject jsonobject_food_size = jsonarray.getJSONObject(j);
          Food_size_Items items = new Food_size_Items();
          items.setLabel(jsonobject_food_size.getString("lable"));
          items.setPrice(Float.parseFloat(jsonobject_food_size.getString("price")));
          items.setSize(jsonobject_food_size.getString("size"));
          mFoodSize.add(items);
          string_spinner_size.add(jsonobject_food_size.getString("lable").concat(" ").concat("- $").
                  concat(jsonobject_food_size.getString("price")));
      }
  </code></pre>
  
  <p>I displayed in listview like below..</p>
  
  <pre><code>public View getView( final int position, View convertView, ViewGroup parent) {
      View rowView = convertView;
      if(null == rowView) {
          rowView = mLayoutInflater.inflate(R.layout.list_toppingcheckbox, null);
          viewHolder = new ViewHolder();
          viewHolder.check_data = (CheckBox) rowView.findViewById(R.id.check_datas);
          viewHolder.check_text = (TextView) rowView.findViewById(R.id.check_text);
          rowView.setTag(viewHolder);
      }
      else {
          viewHolder = (ViewHolder) rowView.getTag();
      }
      final ViewHolder viewHolder = (ViewHolder)rowView.getTag();
      viewHolder.check_data.setText(toppingcomboitem.get(position).getTOPPINGTITLE().concat(" $ "));
      spinner_selected_item_position_string = spinner_selected_item_position_text.getText().toString();
      spinner_selected_item_position_int = Integer.parseInt(spinner_selected_item_position_string);
      viewHolder.check_text.setText(String.valueOf(toppingcomboitem.get(position).getFoodItems().getPriceTopping()));
  </code></pre>
  
  <p>My spinner displays like this...</p>
  
  <pre><code>if(string_spinner_size != null &amp;&amp; string_spinner_size.size() &gt; 1) {
      spinner_size.setVisibility(View.VISIBLE);
      spinner_size.setAdapter(new ArrayAdapter&lt;String&gt;(ToppingItems.this, android.R.layout.simple_spinner_dropdown_item, string_spinner_size));
      spinner_selected_item_position_text.setText(String.valueOf(spinner_selected_item_position));
      spinner_size.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; arg0,
              View arg1, int position, long arg3) {
                  topping_spinner_price = new TextView(ToppingItems.this);
                  topping_spinner_price.setText(String.valueOf(mFoodSize.get(position).getPrice()));
                  topping_string_price = topping_spinner_price.getText().toString();
  
                  topping_spinner_title = new TextView(ToppingItems.this);
                  topping_spinner_title.setText(mFoodSize.get(position).getLabel());
                  topping_string_title = topping_spinner_title.getText().toString();
  
                  topping_spinner_size = new TextView(ToppingItems.this);
                  topping_spinner_size.setText(mFoodSize.get(position).getSize());
                  topping_string_size = topping_spinner_size.getText().toString();
  
                  spinner_selected_item_position = spinner_size.getSelectedItemPosition();
                  spinner_selected_item_position_text.setText(String.valueOf(spinner_selected_item_position));
                  topping_checkbox_adapter.notifyDataSetChanged();
  
          }
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; arg0) { }                          
      });
  } else { 
      spinner_size.setVisibility(View.INVISIBLE); 
  }
  </code></pre>