title: Flash card application
body: <p>I'm developing a flash card application for the Android platform.  So far I have a rough skeleton of a functional application but have hit a road block.  </p>
  
  <p>The application works like this:</p>
  
  <p>Once the top button <code>Flash Cards</code> is Selected the application starts a new activity:</p>
  
  <p>The user is then able to add a new deck by clicking the add the deck button.  Once a deck has been created the idea is that the user will be able to add cards into the corresponding subject.  </p>
  
  <p>This is where I am stuck.  I need to know what the best practice is for creating a list that only corresponds to the given subject.  For example, biology flash cards go under the biology deck, chemistry flash cards under the chemistry deck, etc.</p>
  
  <p>Here is my code for the deck list activity.  My thoughts so far have included somehow bundling a 2D ArrayList into a new activity that created the flash cards.  Any feedback is greatly appreciated. Thanks!  </p>
  
  <p><strong>LISTOFDECKSACTIVITY:</strong></p>
  
  <pre><code> public class ListOfDecksActivity extends Activity implements OnClickListener {
  
      private ListView listView1;
      private Button addDeck;
      final static int deckData = 0;
      private ArrayList&lt;Deck&gt; deck_data;
      private DeckAdapter adapter;
      private View header;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.deck_list);
  
          instantiate();
  
      }
  
      private void instantiate() {
          deck_data = new ArrayList&lt;Deck&gt;();// holds the decks of flash cards
  
          adapter = new DeckAdapter(this, R.layout.deck_item_row,// creates a new
                                                                  // custom
                                                                  // adapter
                  deck_data); // from the adapter class
  
          listView1 = (ListView) findViewById(R.id.listView1);
          header = (View) getLayoutInflater().inflate(R.layout.deck_header_row,
                  null);// Sets up the header for the
                          // list
          listView1.addHeaderView(header);// adds the header to the list view
          listView1.setAdapter(adapter);
          listView1.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                      long arg3) {
                  Intent test = new Intent(ListOfDecksActivity.this,
                          FlashCard.class);
                  startActivity(test);
  
              }
          });
          addDeck = (Button) findViewById(R.id.bAdd);
          addDeck.setOnClickListener(this);// sets up on click listener for submit
                                              // button
  
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          String nameHolder;
          data.getExtras();
          nameHolder = data.getStringExtra("deckTitle");
          deck_data.add(new Deck(R.drawable.ic_launcher, nameHolder));
          adapter.notifyDataSetChanged();
  
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId()) {
          case (R.id.bAdd):
              Intent addDeck = new Intent(ListOfDecksActivity.this,
                      AddDeckActivity.class);
  
              startActivityForResult(addDeck, 1);
          }
  
      }
  
  }
  </code></pre>
  
  <p>P.S. I had photos for clarity however due to a spam mechanism new users are not able to posts pictures.  If you would like to see more code or need any more detail please do not hesitate to ask.</p>