To Lecture Notes

IT 372 -- Apr 13, 2026

Matching Problem

Installing an App on an Android Phone

  1. How do you start an Android app from the virtual device?
    Ans: On the virtual device, if an app is running, click the back arrow to stop the app. Then click in the icon for the app that you want to run.
  2. How do you uninstall an app from the virtual machine?
    Answer: Click the Settings Icon >> See all ? apps, where ? is the actual number of apps. >> Click on the app icon. >> Click Uninstall App.
  3. Look at the complete Magic8Ball Example, complete with all 20 possible predictions.
    If you have an Android phone, you may wish to install this app or other apps on your phone. To do this, turn on Developer options using these directions:
         https://developer.android.com/studio/debug/dev-options
    (You really must tap the Build Number option 7 times to enable Developer options). Then connect your phone to your PC with a USB cable and run the app in the Emulator. This will simultaneously install and run the app on your phone.

Adding a ScrollView

Practice Problems

  1. Display the numbers from 1 to 1000 in a textview control, one number per line. Add a ScrollView to allow the user to swipe up and down to view all the numbers.
    Answer: Here are the layout and activity files:
         activity_main.xml   MainActivity.java
  2. Start with some Lorem Ipsum text in a textview widget:
    Lorem ipsum dolor sit amet, 
    consectetur adipiscing elit. 
    In nibh lectus, accumsan 
    at ligula sagittis, bibendum 
    suscipit enim.
    
    When the textview widget is clicked, concatenate 100 copies of this paragraph together and display the new repeated text in the textview. Add scrollbars so the user can see the entire textview.
    Answer: Here are the layout and activity files:
         activity_main.xml   MainActivity.java   strings.xml
  3. Create a RollDice Example that randomly displays these dice output images displayed in two ImageView widgets:
         face1.jpg  face2.jpg  face3.jpg   face4.jpg  face5.jpg  face6.jpg

    Use this RollDice class:
    public class RollDice {
        public static ArrayList<Integer> roll(int numDiceFaces) {
            ArrayList<Integer> rolls = new ArrayList<Integer>( );
            Random r = new Random( );
            int die1 = r.nextInt(numDieFaces) + 1;
            int die2 = r.nextInt(numDieFaces) + 1;
            rolls.add(die1);
            rolls.add(die2);
            return rolls;
        }
    }
    
    Use android:orientation="horizontal" for the linear layout.
    Answer: Here are the layout, RollDice class, and activity files:
         activity_main.xml   RollDice.java   MainActivity.java

The Design Editor

Project 2

The Android Toast

The Activity Lifecycle