diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..6479f23
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+cursor-adapter-lab
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/cursor-adapter-lab.iml b/.idea/cursor-adapter-lab.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/cursor-adapter-lab.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..aa9be47
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..776d645
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..b5d6642
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1467055730611
+
+ 1467055730611
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/.name b/starter-code/ShoppingListVer2/.idea/.name
new file mode 100644
index 0000000..0b8d2d1
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/.name
@@ -0,0 +1 @@
+ShoppingListVer2
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/compiler.xml b/starter-code/ShoppingListVer2/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/copyright/profiles_settings.xml b/starter-code/ShoppingListVer2/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/encodings.xml b/starter-code/ShoppingListVer2/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/gradle.xml b/starter-code/ShoppingListVer2/.idea/gradle.xml
new file mode 100644
index 0000000..508b3d9
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/gradle.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/misc.xml b/starter-code/ShoppingListVer2/.idea/misc.xml
new file mode 100644
index 0000000..8cdb7eb
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/misc.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/modules.xml b/starter-code/ShoppingListVer2/.idea/modules.xml
new file mode 100644
index 0000000..dc157e2
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/runConfigurations.xml b/starter-code/ShoppingListVer2/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/.idea/vcs.xml b/starter-code/ShoppingListVer2/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/starter-code/ShoppingListVer2/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/MainActivity.java b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/MainActivity.java
index beff131..c484311 100644
--- a/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/MainActivity.java
+++ b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/MainActivity.java
@@ -2,25 +2,112 @@
import android.content.Context;
import android.database.Cursor;
-import android.support.v7.app.AppCompatActivity;
+import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ListView;
-import android.widget.SimpleCursorAdapter;
+import android.widget.TextView;
+
+import java.util.Locale;
import ly.generalassemb.drewmahrt.shoppinglistver2.setup.DBAssetHelper;
public class MainActivity extends AppCompatActivity {
+
+
+ ListView mListView;
+
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+
//Ignore the two lines below, they are for setup
DBAssetHelper dbSetup = new DBAssetHelper(MainActivity.this);
dbSetup.getReadableDatabase();
+
+ String brands[] = {
+ "Colgate",
+ "Downy",
+ "Green Giant"
+ };
+ String items[] = {
+ "toothpaste",
+ "fabric softener",
+ "frozen peas"
+ };
+ Integer prices[] = {
+ 5, 4, 3
+ };
+
+ SQLiteDatabase db;
+ db = openOrCreateDatabase("SHOPPING_LIST.db",
+ SQLiteDatabase.CREATE_IF_NECESSARY,
+ null);
+
+ db.setVersion(7);
+ db.setLocale(Locale.getDefault());
+
+ String createTableSql = "CREATE TABLE IF NOT EXISTS list\n" +
+ " (_id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
+ " brand TEXT,\n" +
+ " item TEXT,\n" +
+ " price INTEGER);";
+
+ db.execSQL(createTableSql);
+
+ Cursor mCursor = db.query("list", null, null, null, null, null, null, null);
+
+
+ mListView = (ListView) findViewById(R.id.shopping_list_view);
+
+ CursorAdapter mCursorAdapter = new CursorAdapter(MainActivity.this, mCursor, 0) {
+ @Override
+ public View newView(Context context, Cursor Cursor, ViewGroup parent) {
+ return LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1,
+ parent, false);
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor Cursor) {
+ TextView txt = (TextView) view.findViewById(android.R.id.text1);
+ String rowData = Cursor.getString(Cursor.getColumnIndex("brand")) +
+ Cursor.getString(Cursor.getColumnIndex("item"));
+ txt.setText(rowData);
+ }
+
+
+ };
+
+ mListView.setAdapter(mCursorAdapter);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
-}
+
+
+
diff --git a/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/DBAssetHelper.java b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/DBAssetHelper.java
index beeea73..ab1f93a 100644
--- a/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/DBAssetHelper.java
+++ b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/DBAssetHelper.java
@@ -12,7 +12,11 @@ public class DBAssetHelper extends SQLiteAssetHelper {
private static final String DATABASE_NAME = "SHOPPING_DB";
private static final int DATABASE_VERSION = 7;
+
public DBAssetHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
+
+
+
}
diff --git a/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/SHOPPING_LIST.java b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/SHOPPING_LIST.java
new file mode 100644
index 0000000..8553eab
--- /dev/null
+++ b/starter-code/ShoppingListVer2/app/src/main/java/ly/generalassemb/drewmahrt/shoppinglistver2/setup/SHOPPING_LIST.java
@@ -0,0 +1,35 @@
+package ly.generalassemb.drewmahrt.shoppinglistver2.setup;
+
+/**
+ * Created by ericaschulz on 6/29/16.
+ */
+public class SHOPPING_LIST {
+
+ public int id;
+ public String brand;
+ public String item;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public String getItem() {
+ return item;
+ }
+
+ public void setItem(String item) {
+ this.item = item;
+ }
+}
diff --git a/starter-code/ShoppingListVer2/build.gradle b/starter-code/ShoppingListVer2/build.gradle
index e0b366a..aff4f41 100644
--- a/starter-code/ShoppingListVer2/build.gradle
+++ b/starter-code/ShoppingListVer2/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/starter-code/ShoppingListVer2/gradle/wrapper/gradle-wrapper.properties b/starter-code/ShoppingListVer2/gradle/wrapper/gradle-wrapper.properties
index f23df6e..d64e910 100644
--- a/starter-code/ShoppingListVer2/gradle/wrapper/gradle-wrapper.properties
+++ b/starter-code/ShoppingListVer2/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Oct 21 11:34:03 PDT 2015
+#Tue Jun 28 19:19:41 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip