title: Android Listview with sections
body: <p>Hi I am having an issue trying to understand how sectioned ListViews work. I had it working into a normal list view. but now I want to add sections to my list. How to I ad a section header in.  </p>
  
  <p>Heres my code that works. </p>
  
  <pre><code>public class ChooseTeamActivity extends ListActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
      setContentView(R.layout.chooseact);    
  
      String FullData = getIntent().getStringExtra("FullData");
  
      try{
  
        JSONObject obj = new JSONObject(FullData);
        List&lt;String&gt; leagues = new ArrayList&lt;String&gt;();
  
        JSONObject objData = obj.getJSONObject("data");
  
        JSONArray jArray = objData.getJSONArray("structure");
  
  
        for (int i=0; i &lt; jArray.length(); i++) {
          JSONObject oneObject = jArray.getJSONObject(i);   
          leagues.add(oneObject.getString("league_website_name"));
          JSONArray DivisionsArray = oneObject.getJSONArray("divisions");
  
          for (int d=0; d &lt; DivisionsArray.length(); d++){            
             JSONObject DivDict = DivisionsArray.getJSONObject(d);   
             leagues.add(DivDict.getString("name"));              
          }               
       }         
  
        setListAdapter ( new ArrayAdapter&lt;String&gt;(this, R.layout.single_item, 
                                                                      leagues));
  
        ListView list = getListView();
        list.setTextFilterEnabled(true);
  
      } catch (JSONException e) {
          e.printStackTrace();
      }     
      }
  }
  </code></pre>