To Lecture Notes

IT 372 -- May 13, 2019

Review Questions

  1. Which classes/objects are used when working with Sqlite databases in an Android app?
    Ans: SQLiteOpenHelper, derived class StudentsDBHelper, SQLiteDatabase, ContentValues, Cursor
  2. How do you add strings to a spinner, both in the XML layout file and dynamically in the Java activity file?
    Ans: In the layout, set up an array in strings.xml that contains the strings to go into the spinner. Then set the entries property to connect this array to the spinner. In the activity code, use an ArrayAdapter object to connect an ArrayList collection to the spinner.
  3. Write a simple Android app that tests a RatingBar widget. (On the takehome final, you will be asked to test a widget that we have not covered in class.)
  4. What techniques do you use for debugging your Android apps?
    Ans: (a) Write lines to the Logcat window with Log.i or to the Run window with System.out.println.
    (b) Comment out lines and add them back in one by one to locate the line that causes the app to crash.
    (c)Use the Android Debugger: put breakpoints in your code, which show up as maroon disks in the gray area to the left of the editor lines. Use the Debug 'app' button in the toolbar to the right to start the debugger. Step Over, Step Into, and Step Out buttons above the Debug Window at the bottom of Android Studio. Check the values of variables in the Variable Window. Here are, respectively, the Android Studio Debug 'app', Step Over, Step Into, and Step Out buttons:
    Debug 'app' Step Over Step Into Step Out

Project 4

MonthButtons Examples

Drawing in a View

Responding to Touch Events