Kotlin is Google's preferred language for Android App Development, so the code you wrote in class can be used in a mobile application!
In part 2 of the project, you developed implementations of an IDeck
interface.
Because of this level of abstraction, while you developed a console-based application (via reactConsole
), we were able to develop a GUI (graphical user interface) that allows you to study interactively on a virtual or physical device.
This guide will walk you through setting up your machine for Android development and creating your first project.
Credit: These materials were largely developed by Erica Sammarco (sammarco.e@northeastern.edu).
Follow the instructions below to setup all required tools for Android development.
You will use Android Studio to create your app and run it on simulated or hardware devices.
We'll first create an empty project in Android Studio -- then we'll incorporate code we wrote for the interaction, as well as your code from the project to supply the deck of question/answer content.
Flashcard App
.
Leave the other settings as they are and click the "Finish" button.
MainActivity.kt
file (using the "Project" navigation on the left).package com.example.projectName
MainActivity.kt
with the contents of the starter file.
com.example.projectName
)!reactConsole
to handle state & rendering at the console :)onCreate
function -- we need to provide the app with a deck! To do so, we will have to add some of our project code to this project.package com.example.projectName
at the top -- again, make sure that this line exists at the top of both files.p2.kt
file we will want to insert our definition for an IDeck
and the subsequent implementations of it.
p2.kt
: "Flash Card data design", "Deck design" (including TaggedFlashCard
, DeckState
, IDeck
, TFCListDeck
, and PerfectSquaresDeck
.p2.kt
-- we will not be importing the Khoury library into this project, so the file will not compile while the tests are present.
ExampleUnitTest.kt
and ExampleInstrumentedTest.kt
files to see how what we've been doing all semester has a parallel in real mobile-app development.MainActivity.kt
.
MainActivity.kt
and find the TODO within the onCreate
function -- replace the comment with a valid instance of an IDeck
.
PerfectSquaresDeck
, but you could use TFCListDeck
.
onCreate
function and re-run the app!You have created your first Android application -- feel free to play around with the code and see how you can improve this app 🤓