An Android quiz application that allows users to answer questions, view quiz results, and review previous attempts. It uses local database storage to maintain quiz history and provides an option to clear saved records.
Answer questions, view results, review attempts, and manage quiz history with local storage.
The Student Quiz App is an Android application developed with Kotlin and Jetpack Compose. It allows students to answer quiz questions, view their results immediately after completion, and review their previous quiz attempts. The app uses Room Database for local storage, so quiz history is persisted on the device and remains available even after the app is closed.
Built with a modern declarative UI using Jetpack Compose, the app provides a smooth and responsive experience. The Room database layer abstracts SQLite operations, making it easy to insert, query, and delete quiz records. Users can also clear all saved records whenever they want to start fresh.
Problem: Quiz attempts needed to be saved locally so users could review them later, including across app restarts. Using raw SQLite would have required a lot of boilerplate code.
Solution: Integrated Room Database as an abstraction layer over SQLite. Defined entities for quiz records, Data Access Objects (DAOs) for CRUD operations, and a database class. Room handles schema management and reduces boilerplate significantly.
Problem: Showing a list of previous attempts that updates in real time as new quizzes are completed, while also allowing users to clear all records, required careful state handling.
Solution: Used Room's observable queries (Flow) so the history list automatically recomposes whenever data changes. The clear records operation deletes all entries and the UI updates instantly, giving users immediate feedback.
Problem: Managing the quiz flow—question navigation, answer selection, score calculation, and result display—in a declarative UI framework can be complex.
Solution: Modeled the quiz state with a ViewModel and Compose state. Each screen (question, result, history) reads from and updates the state, ensuring the UI stays in sync. Score is calculated based on selected answers and stored once the quiz finishes.