Shorr H Android Development 2025-26-Period 1 Assignments
- Instructor
- Mr. Garrett Shorr
- Term
- 2025-2026 School Year
- Department
- Mathematics
- Description
-
Upcoming Assignments
Due:
Requirements:
View Binding is enabled and you are using the binding notation when referencing widgets. Example:
binding.buttonMainSong.setOnClicklistener { }
noteMap is implemented
playSong is a suspend function
a coroutine is used to launch the playSong function
Max Value: 85% with no challenge completed (note challenge must be your original work. plagiarism is plagiarism even outside of English & Social Studies classes).
Max Value 100% with a challenge completed.
Submit the following:
A pdf of your MainActivity.kt and activity_main.xml done through the print menu item. If you added your own songs via json, include those as well.
View Binding is enabled and you are using the binding notation when referencing widgets. Example:
binding.buttonMainSong.setOnClicklistener { }
noteMap is implemented
playSong is a suspend function
a coroutine is used to launch the playSong function
Max Value: 85% with no challenge completed (note challenge must be your original work. plagiarism is plagiarism even outside of English & Social Studies classes).
Max Value 100% with a challenge completed.
Submit the following:
A pdf of your MainActivity.kt and activity_main.xml done through the print menu item. If you added your own songs via json, include those as well.
Past Assignments
Due:
Download and unzip the SoundboardStarter project and open it in Android Studio. Follow along with the questions in the google doc and answer them in a different color.
I've attached a zip with sounds for a full piano, if you want more than the 2 octaves I've provided. They are listed by key number and you'll have to figure out which key number matches up with each note.
The only thing that is due is the 4 questions.
I've attached a zip with sounds for a full piano, if you want more than the 2 octaves I've provided. They are listed by key number and you'll have to figure out which key number matches up with each note.
The only thing that is due is the 4 questions.
Due:
Due Thursday
1. Screenshot of the activity_main.xml layout (with special instructions, see below & video)
Design & Blueprint turned on
Show all constraints turned on
2. print to pdf the activity_main.xml
Combine both into one file.
1. Screenshot of the activity_main.xml layout (with special instructions, see below & video)
Design & Blueprint turned on
Show all constraints turned on
2. print to pdf the activity_main.xml
Combine both into one file.
Due:
Tentatively Due End of Class Monday.
Submission Checklist:
Quiz works and completes without crashing
Score is calculated correctly
Changing the phone language to your chosen second language fully translates the entire app to that language
No hardcoded strings--all strings are in strings.xml
All quiz logic is handled by the Quiz class (i.e. things like score variables are stored in the Quiz class and not the MainActivity)
The program will not crash or otherwise fail to act correctly if it is fed json with different numbers of questions in the appropriate format
Quiz & Question classes have no knowledge of Android-specific functions
Print the following files to a pdf:
MainActivity.kt
Quiz.kt
Question.kt
activity_main.xml
both question.json files
both strings.xml files
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf. Open the pdf and verify it has all the files in it before submitting.
Submission Checklist:
Quiz works and completes without crashing
Score is calculated correctly
Changing the phone language to your chosen second language fully translates the entire app to that language
No hardcoded strings--all strings are in strings.xml
All quiz logic is handled by the Quiz class (i.e. things like score variables are stored in the Quiz class and not the MainActivity)
The program will not crash or otherwise fail to act correctly if it is fed json with different numbers of questions in the appropriate format
Quiz & Question classes have no knowledge of Android-specific functions
Print the following files to a pdf:
MainActivity.kt
Quiz.kt
Question.kt
activity_main.xml
both question.json files
both strings.xml files
Print using the following settings:
JetBrains Mono font size 8
Margins of 0.25 all around
Color Printing
Save as a pdf. Open the pdf and verify it has all the files in it before submitting.
Due:
Open the textedit app on your computers and make the font size at least 64. Write your answers to these questions there.
REVIEW
This is how you make a string template in your strings.xml. %1$s means 1st parameter (%1), string datatype ($s). %2$d means 2nd parameter (%2), decimal (integer. decimal as in base 10) datatype ($d)
Hello, %1$s! You have %2$d new messages.
This creates a string that looks like: Hello, name! You have 5 new message.
This is how you would retrieve the template in your Activity. You provide variables for each parameter you described in the string template.
var text = resources.getString(R.string.welcome_messages, username, mailCount)
QUESTIONS
1a:Make a string formatting template (that would be in the strings.xml file) for a 2 player score in the following format:
P1: 10 -- P2: 5
1b: How would you access and use that string template using the variables score1 and score2?
2a: Make a string template & getString call for a chapter and chapter title text in the following format (specific example and general format below):
Chapter 2: Revenge of Chapter 1
Chapter [number]: [title]
2b: How would you access and use that string template using the variables chNum and chTitle?
REVIEW
This is how you make a string template in your strings.xml. %1$s means 1st parameter (%1), string datatype ($s). %2$d means 2nd parameter (%2), decimal (integer. decimal as in base 10) datatype ($d)
This creates a string that looks like: Hello, name! You have 5 new message.
This is how you would retrieve the template in your Activity. You provide variables for each parameter you described in the string template.
var text = resources.getString(R.string.welcome_messages, username, mailCount)
QUESTIONS
1a:Make a string formatting template (that would be in the strings.xml file) for a 2 player score in the following format:
P1: 10 -- P2: 5
1b: How would you access and use that string template using the variables score1 and score2?
2a: Make a string template & getString call for a chapter and chapter title text in the following format (specific example and general format below):
Chapter 2: Revenge of Chapter 1
Chapter [number]: [title]
2b: How would you access and use that string template using the variables chNum and chTitle?
Due:
1. Download the pluslife.json file.
2. In the Quiz App, create a new empty views activity. activity called PracticingJsonActivity and edit the manifest to have it be the starting activity.
3. Add a companion object with a constant for TAG = "PracticingJson" to make the logging autocomplete work nicely.
---- New Material Here ----
4. In the raw folder, add the pluslife.json file to that raw folder.
5. Add the Gson library dependency if you haven't alrady
6. Create model classes (data classes) for the pluslife.json file.
In the top-level class:
targetTemp
testData
In testData:
need both lists
In temperatureSamples:
need all of it
In samples:
startingChannel
firstChannelResult
// examples of for loops in java vs kotlin
// assume that we have List called tempSamples
// in java, an enhanced for loop would look like:
// for(TempSample sample: tempSamples)
// in kotlin
// for(sample in tempSamples)
// in java, a traditional for loop...
// for(int i = 0; i < tempSamples.size; i++) {
// tempSamples[i]...
val tempSamples = listOf(1, 2, 3) // this is for demo purposes
for(i in 0..(tempSamples.size-1)) {
tempSamples[i]
}
for(i in 0 until tempSamples.size) {
tempSamples[i]
}
for(i in tempSamples.indices) {
tempSamples[i]
}
Assignment: Answer the questions below, check your answers against the provide solutions, submit the code you used to solve each problem.
Analyze the temperature data found in the list of TemperatureSample to answer the following:
1. max temp
2. min temp
3. average temp
4. largest difference from target temperature (- value means below)
5. location of the largest difference (the index in the temperature samples list)
6. number of temperatures that were more than .5 degrees from the target temp
Analyze the test data in the list of Sample to answer the following:
1. Create a list that only contains the firstChannelResult of every sample in the control channel startingChannel = 3.
2. Does it increase the whole time? We will consider no change between adjacent items acceptable. So [1, 3, 3, 5] would be considered increasing the whole time but [1, 3, 2, 5] would not.
3. Create a list of the differences between consecutive data points. What are the largest 3 differences?
Answers to check against:
Solutions to check against:
MAX: 65.1773910522461
MIN: 61.105535999853516
AVG: 63.03702001527299
LARGEST DIFF: 2.1773910522460938
TOTAL DIFFS ABOVE THRESHOLD: 23
MAX DIFF INDEX: 456
Is it Increasing? Yes
Top 3 diffs: Top 3 diffs: [1536, 1408, 1024]
2. In the Quiz App, create a new empty views activity. activity called PracticingJsonActivity and edit the manifest to have it be the starting activity.
3. Add a companion object with a constant for TAG = "PracticingJson" to make the logging autocomplete work nicely.
---- New Material Here ----
4. In the raw folder, add the pluslife.json file to that raw folder.
5. Add the Gson library dependency if you haven't alrady
6. Create model classes (data classes) for the pluslife.json file.
In the top-level class:
targetTemp
testData
In testData:
need both lists
In temperatureSamples:
need all of it
In samples:
startingChannel
firstChannelResult
// examples of for loops in java vs kotlin
// assume that we have List
// in java, an enhanced for loop would look like:
// for(TempSample sample: tempSamples)
// in kotlin
// for(sample in tempSamples)
// in java, a traditional for loop...
// for(int i = 0; i < tempSamples.size; i++) {
// tempSamples[i]...
val tempSamples = listOf(1, 2, 3) // this is for demo purposes
for(i in 0..(tempSamples.size-1)) {
tempSamples[i]
}
for(i in 0 until tempSamples.size) {
tempSamples[i]
}
for(i in tempSamples.indices) {
tempSamples[i]
}
Assignment: Answer the questions below, check your answers against the provide solutions, submit the code you used to solve each problem.
Analyze the temperature data found in the list of TemperatureSample to answer the following:
1. max temp
2. min temp
3. average temp
4. largest difference from target temperature (- value means below)
5. location of the largest difference (the index in the temperature samples list)
6. number of temperatures that were more than .5 degrees from the target temp
Analyze the test data in the list of Sample to answer the following:
1. Create a list that only contains the firstChannelResult of every sample in the control channel startingChannel = 3.
2. Does it increase the whole time? We will consider no change between adjacent items acceptable. So [1, 3, 3, 5] would be considered increasing the whole time but [1, 3, 2, 5] would not.
3. Create a list of the differences between consecutive data points. What are the largest 3 differences?
Answers to check against:
Solutions to check against:
MAX: 65.1773910522461
MIN: 61.105535999853516
AVG: 63.03702001527299
LARGEST DIFF: 2.1773910522460938
TOTAL DIFFS ABOVE THRESHOLD: 23
MAX DIFF INDEX: 456
Is it Increasing? Yes
Top 3 diffs: Top 3 diffs: [1536, 1408, 1024]
Due:
One thing programmers often do is learn by reading through tutorials. Use the various resources provided in the document to find the answers to the questions and use a different color when answering.
You can work in groups but each turn in an individual document.
You can work in groups but each turn in an individual document.
Due:
Due sometime Friday
1. Start/Stop works & doesn't skip time
2. Maintain state through orientation change
3. Reset should set the time to 0. It's up to you whether or not you keep it running if it were running when clicking reset.
*if it were running, stay running & not skip time
*if it were stopped, stay stopped & not skip time
having a rounding error of 1 second is okay.
To turn this in, we'll use Quicktime screen record to record a movie of the following:
Start
Wait 3 seconds
Stop
Wait 3 seconds
Start
Wait 3 seconds
Stop
Rotate
Wait 3 seconds
Start
Rotate
Wait 3 seconds
Stop
Reset
Start
Wait 3 seconds
Reset
1. Start/Stop works & doesn't skip time
2. Maintain state through orientation change
3. Reset should set the time to 0. It's up to you whether or not you keep it running if it were running when clicking reset.
*if it were running, stay running & not skip time
*if it were stopped, stay stopped & not skip time
having a rounding error of 1 second is okay.
To turn this in, we'll use Quicktime screen record to record a movie of the following:
Start
Wait 3 seconds
Stop
Wait 3 seconds
Start
Wait 3 seconds
Stop
Rotate
Wait 3 seconds
Start
Rotate
Wait 3 seconds
Stop
Reset
Start
Wait 3 seconds
Reset
Due:
Due Wednesday
The bolded sections of the attached document have things for you to write and complete. The non-bolded sections have instructions for you to follow but don't need to have written answers for.
Complete the sections in a different font color so it's easy to see your work inline.
In the video: intro to the stopwatch app, how to use XML and add a chronometer widget, how to override a function through autocomplete, how to make a static constant in kotlin through a companion object.
1. Open the project that we set up github with "Stopwatch".
2. Add Chronometer widget to activity_main.xml through the code view
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chronometer_main_stopwatch"/>
and constraint it in the design view. You can also change the text size to something like 64sp so you can see it more easily.
The bolded sections of the attached document have things for you to write and complete. The non-bolded sections have instructions for you to follow but don't need to have written answers for.
Complete the sections in a different font color so it's easy to see your work inline.
In the video: intro to the stopwatch app, how to use XML and add a chronometer widget, how to override a function through autocomplete, how to make a static constant in kotlin through a companion object.
1. Open the project that we set up github with "Stopwatch".
2. Add Chronometer widget to activity_main.xml through the code view
android:layout_height="wrap_content"
android:id="@+id/chronometer_main_stopwatch"/>
and constraint it in the design view. You can also change the text size to something like 64sp so you can see it more easily.
Due:
Use a different color font to answer the questions directly inline with your copy of the document. We'll have 20 minutes at the start of class on Monday.
For the project itself, these are the features:
Self Destruct Button: Launch a CountDownTimer, change the text on the button with a countdown from 10 to 1 or 0. End the activity upon reaching the end.
Stretch goal: Make the layout blink red, increasingly faster as the timer gets closer to 0. Disable the button after it is pressed.
Useless switch: Turn it on and it automatically turns off x seconds later.
Stretch goal: Randomize the timer. Cancel the timer if it is turned off before the timer is finished.
Look Busy: Hide the regular UI, show the progress bar and the textview
Return the regular UI after the progress bar has finished filling.
For the project itself, these are the features:
Self Destruct Button: Launch a CountDownTimer, change the text on the button with a countdown from 10 to 1 or 0. End the activity upon reaching the end.
Stretch goal: Make the layout blink red, increasingly faster as the timer gets closer to 0. Disable the button after it is pressed.
Useless switch: Turn it on and it automatically turns off x seconds later.
Stretch goal: Randomize the timer. Cancel the timer if it is turned off before the timer is finished.
Look Busy: Hide the regular UI, show the progress bar and the textview
Return the regular UI after the progress bar has finished filling.
Due:
In a google doc, answer the following questions.
Compare your code to the code I've provided and answer the following questions:
1. Do you notice anything different about the content of the onClickListeners?
2. In the code provided, what do you notice about the organization of all the findViewById method calls?
3. In the code provided, where do you notice the logic is for comparing numbers and keeping score?
4. What advantages might there be for separating the game logic from the UI logic?
5. Paste your code from your MainActivity at the bottom.
The kotlin files: https://gist.github.com/gshorrSPHS/8ef08ec44462024540e6d7364ff803ea
Compare your code to the code I've provided and answer the following questions:
1. Do you notice anything different about the content of the onClickListeners?
2. In the code provided, what do you notice about the organization of all the findViewById method calls?
3. In the code provided, where do you notice the logic is for comparing numbers and keeping score?
4. What advantages might there be for separating the game logic from the UI logic?
5. Paste your code from your MainActivity at the bottom.
The kotlin files: https://gist.github.com/gshorrSPHS/8ef08ec44462024540e6d7364ff803ea
Due:
Submit answers in the attached google doc below. (explanation is at the end of the video)
Due:
Please return the signed syllabus by Tuesday, 8/19.
Due:
Complete the attached survey and mark this assignment complete when you are done.
Due:
What are 5 differences that you see in the Main Activity between Kotlin and Java?
Kotlin Code:
package com.example.buttonclicker
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
------
Kotlin vs Java
1. "fun" keyword is used to define a function
2. when defining a subclass or implementing an interface, you use : instead of extends or implements
3. no semicolons to end a line
4. public is the default access modifier in kotlin so you don't need to write it
5. in kotlin parameter format: varName: DataType
6. no return type in the oncreate because it's void. returning nothing doesn't require the void return type
7. Bundle? vs Bundle. Kotlin has null safety. If something could be null, it has to have ? attached to the data type.
8. override is required if you are overriding a function from the parent class
Kotlin Code:
package com.example.buttonclicker
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
------
Kotlin vs Java
1. "fun" keyword is used to define a function
2. when defining a subclass or implementing an interface, you use : instead of extends or implements
3. no semicolons to end a line
4. public is the default access modifier in kotlin so you don't need to write it
5. in kotlin parameter format: varName: DataType
6. no return type in the oncreate because it's void. returning nothing doesn't require the void return type
7. Bundle? vs Bundle. Kotlin has null safety. If something could be null, it has to have ? attached to the data type.
8. override is required if you are overriding a function from the parent class