title: Android: create CheckBox in activity.java
body: <p>Hi i want to create dynamical number of checkboxes (it depends on the length of array "genre") in an Android app then i did:</p>
  
  <pre><code>CheckBox [] checkbox;
  String [] genre={"party","sport","music","café","education"};
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      checkbox=new CheckBox[genre.length];
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_checkbox);
      for(int i=0;i&lt;genre.length;i++){
          CheckBox c=new CheckBox(this);
          c.setText(genre[i]);
          checkbox[i]=c;  
      }
       ArrayAdapter&lt;CheckBox&gt;adapter= new ArrayAdapter&lt;CheckBox&gt;(this, android.R.layout.simple_list_item_1,checkbox);
       ListView lv= (ListView)findViewById(R.id.genre_list);
       lv.setAdapter(adapter);
  }
  </code></pre>
  
  <p>but in the listview it shows numbers of the checkboxes in memory(I guess), why?</p>
  
  <pre><code>like : Android.wiget.CheckBox@44f03160
         Android.wiget.CheckBox@44f03d60
        ...
  </code></pre>