Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
18 Cards in this Set
- Front
- Back
Syntax for inserting something in the database |
|
|
T/F you need a constants class |
false, you don't need one, you can put in a string name on your own (its just better to have a constants class tho) |
|
what is in the database class? |
- SQLiteDatabase instance and helper |
|
what 2 important methods are in the SQLiteOpenHelper |
onCreate() and onUpgrade() |
|
what is in the constants class? (if you make one) |
holds all the string constants (e.g table names, column names, etc.) |
|
T/F - we want to keep the UI code separate from the database code |
true (i have no idea why this is so important rn) |
|
what is this syntax doing? private static final String CREATE_TABLE = "CREATE TABLE" + Constants.TABLE_NAME + "(" +Constants.UID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + Constants.COLUMN_NAME1 + "TEXT, " +Constants.COMUM_NAME2 + "TEXT);" ; |
creating/setting up a table |
|
what is wrong with this: private static final String CREATE_TABLE = "CREATE TABLE" + Constants.TABLE_NAME + "(" + Constants.COLUMN_NAME1 + "TEXT, "+ Constants.COMUM_NAME2 + "TEXT);" ; |
missing: Constants.UID + " INTEGER PRIMARY KEY AUTOINCREMENT, " |
|
whats wrong with this? private static final String CREATE_TABLE = "CREATE TABLE" + Constants.TABLE_NAME + "(" +Constants.UID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + Constants.COLUMN_NAME1 + "TEXT, " +Constants.COMUM_NAME2 + "TEXT)" ; |
missing a semicolon before the last semicolon >): private static final String CREATE_TABLE = "CREATE TABLE" + Constants.TABLE_NAME + "(" +Constants.UID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + Constants.COLUMN_NAME1 + "TEXT, " +Constants.COMUM_NAME2 + "TEXT) ; " ; |
|
what are the two things passed into the query method when reading data from the database? |
selection criteria and the desired columns |
|
what are the results in the query returned in? |
a cursor object |
|
what is a cursor? |
gives us access to the results returned from a database query and allows navigation through the result set |
|
what is the syntax of the query method? |
public Cursor query (boolean distinct, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit){...} |
|
what is the parameter boolean distinct for in the query method? |
make true if you want each row to be unique |
|
what is the parameter String having for in the query method? |
a filter to declare what groups to include in the cursor |
|
what is a SimpleCursorAdapter? |
an adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file |
|
what is a way to link the database to UI? |
use a ListView - basically anything that will show the contents of the database |
|
what are the advantages of using a SimpleCursorAdapter |
- don't need to process the data from the cursor - is a simplified getData() method |