dogriffiths/HeadFirstAndroid

Request.

Opened this issue · 0 comments

Your Starbuzz cafe project was a very useful lesson that taught me how to use a number of methods. It also is a prototype for an ordering app, something that is much needed in supply and sales industries.
One very important thing I couldn't figure out is how to create a working set of subcategories. Your project only features 3 items in the top category. Can you show us how you would fill out the 2 other categories? I built a project that attempt this by adding categories as a column to the table I had to uncomment quite a few of your checks and, ultimately, the top category wouldn't display anything after I removed the position ==0 check. Items displayed in the additonal categories I added to the array.
Here's a snippet:

// if (position == 0) {  //commented this out because nothing would display except top category.
 Intent intent = new Intent(TopLevelActivity.this,ItemCategoryActivity.class);
                    intent.putExtra(ItemCategoryActivity.CATEGORYID, (int)id);
                    startActivity(intent);

and

 cursor = db.query("InventoryItem",
                              new String[]{"_id", "NAME"},
                               "categoryId = ?",
                              new String[] { Long.toString(categoryId) },
                              null, null, null, null);