To Lecture Notes

IT 372 -- May 6, 2024

Review Questions

  1. Add a TextView widget to a constraint layout. Change the font family of the widget using the Design Layout Editor. Check out these files that are modified:
    res/activity_main.xml      res/font/font_name.(ttf | xml)
    res/values/font_certs.xml  res/values/preloaded_fonts.xml
    
    Answer: Use the Design Editor to select the fontFamily attribute. You can either use one of the predefined fonts,
  2. Set up a main activity with a Spinner containing the names of birds, and two button widgets. The first button has the caption Add Bird; the second button has the caption Display Birds in ArrayList. When first button is clicked the selected bird in the spinner is added to the arraylist. When the second button is clicked, the birds arraylist is passed to a new activity, an output string is created from the birds in the arraylist, and the output string is displayed in a textview.
    Answer: Here are the app files:
          activity_main.xml  strings.xml   MainActivity.java
          activity_show_birds.xml  ShowBirdsActivity.java
  3. Set up a main activity with an arraylist to which Pet objects are added. In an Intent object, pass the arraylist to a a second display activity and display the arraylist contents on the second activity. Use Serialization to pass the activity to the intent. Serialization can also be used to put an arraylist in a Bundle object for when an activity is destroyed and recreated.
    Answer: To be posted soon.

Android Platform and Architecture

Adding Widgets Dynamically

Responding to Touch Events