0% found this document useful (0 votes)
5 views9 pages

StudentGradingApp Guide

The document is a comprehensive guide for developing a Student Grading App using Android Studio, covering setup, project creation, and file structure. It details the app's functionalities, including adding, editing, deleting, and searching for student records, as well as viewing class statistics. Additionally, it provides troubleshooting tips and customization options for enhancing the app's features and appearance.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

StudentGradingApp Guide

The document is a comprehensive guide for developing a Student Grading App using Android Studio, covering setup, project creation, and file structure. It details the app's functionalities, including adding, editing, deleting, and searching for student records, as well as viewing class statistics. Additionally, it provides troubleshooting tips and customization options for enhancing the app's features and appearance.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Student Grading App

Android Studio — Complete Developer Guide


Setup • Code Reference • Virtual Machine • Usage

3 Screens SQLite DB Search Grades


Main, Add/Edit, Stats Built-in persistence Live student filter A-F with pass/fail

1. Project Setup in Android Studio


1.1 System Requirements
Component Requirement
OS Windows 10/11, macOS 12+, or Ubuntu 20.04+
RAM 8 GB minimum — 16 GB strongly recommended
Disk Space At least 8 GB free (Android Studio + SDK + Emulator)
Java JDK 17+ (bundled with Android Studio Hedgehog or newer)
Android Studio Hedgehog (2023.1.1) or newer — latest stable recommended
Android SDK API Level 34 (Android 14) — installed via SDK Manager

1.2 Installing Android Studio


1. Go to [Link] and download the installer for your OS.
2. Run the installer. On Windows, accept all defaults. On macOS, drag Android Studio
into /Applications.
3. On first launch, the Setup Wizard will appear. Choose Standard installation.
4. The wizard will download the Android SDK, build tools, and a default emulator image
automatically.
5. Once complete, click Finish. Android Studio will open to the Welcome screen.

Tip
If you already have Android Studio installed, go to Help > Check for Updates to make sure you are on
the latest version before proceeding.

1.3 Creating the Project


6. From the Welcome screen, click New Project.
7. In the template selector, choose Empty Views Activity and click Next.
8. Fill in the project details:
◦ Name: StudentGradingApp
◦ Package name: [Link]
◦ Save location: choose any folder on your machine
◦ Language: Java
◦ Minimum SDK: API 24 (Android 7.0 Nougat)
9. Click Finish. Android Studio will create and sync the project (this may take 1-2 minutes).

1.4 Setting Up the File Structure


Your project must have the following structure exactly. Right-click on folders in the Project panel
to create sub-packages and XML files:

File / Folder Purpose


app/src/main/java/.../[Link] Main screen — student list + search
app/src/main/java/.../ Add or edit a student's record
[Link]
app/src/main/java/.../[Link] Class statistics overview screen
app/src/main/java/.../model/[Link] Data model — fields + grade logic
app/src/main/java/.../adapter/ RecyclerView list adapter
[Link]
app/src/main/java/.../database/ SQLite database CRUD operations
[Link]
app/src/main/res/layout/activity_main.xml Main screen layout
app/src/main/res/layout/ Add/Edit screen layout
activity_add_edit_student.xml
app/src/main/res/layout/activity_stats.xml Statistics screen layout
app/src/main/res/layout/item_student.xml Single student card layout
app/src/main/res/values/[Link] App colour palette
app/src/main/res/values/[Link] App theme and toolbar style
app/src/main/res/values/[Link] App name string resource
app/src/main/res/drawable/search_bg.xml Rounded search bar background
File / Folder Purpose
app/src/main/res/drawable/grade_circle.xml Oval badge for letter grade
app/src/main/res/menu/main_menu.xml Toolbar menu (Stats button)
app/src/main/[Link] Declares all Activities
app/[Link] App-level Gradle config + dependencies

1.5 Configuring app/[Link]


Open app/[Link] and make sure the dependencies block contains:

app/[Link] — dependencies block


implementation '[Link]:appcompat:1.6.1' implementation
'[Link]:material:1.11.0' implementation
'[Link]:recyclerview:1.3.2' implementation '[Link]:cardview:1.0.0'
implementation '[Link]:coordinatorlayout:1.2.0' implementation
'[Link]:constraintlayout:2.1.4'

After editing, click the Sync Now banner at the top of the editor, or go to File > Sync Project with
Gradle Files.

2. Setting Up the Android Virtual Device (Emulator)


2.1 Opening the AVD Manager
10. In Android Studio, go to Tools > Device Manager (or click the phone icon in the right
sidebar).
11. Click the + button (Create Virtual Device).
12. In the hardware list, select Pixel 6 (recommended) and click Next.

2.2 Selecting the System Image


13. In the System Image step, click the Recommended tab.
14. Select API Level 34 (Android 14, "UpsideDownCake"). If it shows a download arrow,
click Download next to it and wait for it to complete.
15. Once downloaded, select it and click Next.
16. Review the AVD configuration. The defaults are fine. Click Finish.

2.3 Enabling Hardware Acceleration (Important for Performance)


Without hardware acceleration, the emulator will be very slow. Follow the instructions for your
OS:
Windows — Enable HAXM or Hyper-V
Option A (Intel CPU): Go to SDK Manager > SDK Tools > Intel x86 Emulator Accelerator (HAXM).
Install it, then run the HAXM installer from C:\Users\<you>\AppData\Local\Android\Sdk\extras\intel\
Hardware_Accelerated_Execution_Manager\. Option B (Hyper-V): Open Windows Features, enable
Hyper-V and Windows Hypervisor Platform. Restart. In Android Studio select a system image that
shows "(Hyper-V)" in the ABI column.

macOS — Metal is used automatically


On Apple Silicon (M1/M2/M3), select an ARM64 system image (marked 'arm64-v8a'). Hardware
acceleration is handled automatically by the macOS Hypervisor framework. No additional setup is
needed.

Linux — Enable KVM


Run: sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils Then: sudo adduser
$USER kvm Log out and back in. Verify with: kvm-ok

2.4 Launching the Emulator


17. In Device Manager, find your Pixel 6 AVD and click the Play (triangle) button.
18. The emulator will boot — the first boot takes 1-3 minutes.
19. Once you see the Android home screen, the emulator is ready.
20. Back in Android Studio, click the green Run button (Shift+F10) or go to Run > Run 'app'.
21. Select your Pixel 6 emulator in the device chooser and click OK.
22. The app will compile, install, and launch on the emulator automatically.

Tip — Run on a Real Device


Connect your Android phone via USB. Enable Developer Options (tap Build Number 7 times in
Settings > About Phone), then enable USB Debugging. Your device will appear in the device chooser
alongside the emulator.

3. Code Guide — How Each File Works


3.1 [Link] — The Data Model
Location: model/[Link]
This class represents a single student record. It stores the student's name, unique student
number, and four subject grades (Mathematics, Science, English, History). It contains three
computed methods that you can call anywhere in the app:
Method Description
getAverage() Returns the mean of the four subject grades as a double (0–100).
getLetterGrade() Returns 'A' (90+), 'B' (80+), 'C' (70+), 'D' (60+), or 'F' (<60).
getStatus() Returns 'Pass' if average >= 60, otherwise 'Fail'.

To add more subjects, add a new private double field, a getter/setter pair, and update
getAverage() to include the new subject in the sum and divisor.

3.2 [Link] — SQLite Persistence


Location: database/[Link]
This class extends SQLiteOpenHelper and manages all data storage. It creates a single table
called 'students' with columns for each field. The key methods are:

Method What it does


addStudent(Student s) Inserts a new row. Returns -1 if the student number already exists
(UNIQUE constraint).
updateStudent(Student s) Updates all fields for the student with the matching id.
deleteStudent(int id) Removes the row with the given id.
getAllStudents() Returns a List<Student> sorted A-Z by name.
searchStudents(String q) Returns students whose name or number contains the query
(case-insensitive LIKE).
getClassAverage() Returns the mean average across all students.
getPassCount() Returns how many students have an average >= 60.

3.3 [Link] — The Student List


Location: [Link]
This is the home screen. On creation it loads all students from the database and displays them
in a RecyclerView. It also:
• Observes the search bar and calls filterStudents() on every keystroke — no button press
needed.
• Calls loadStudents() inside onResume() so the list always refreshes after returning from
the Add/Edit screen.
• Inflates the toolbar menu so the Stats icon appears in the top-right corner.
• Launches AddEditStudentActivity when the FAB (blue + button) is pressed.
3.4 [Link] — Add or Edit a Student
Location: [Link]
This screen serves two purposes controlled by whether a student_id extra is passed in the
Intent:
• No extra passed: the screen is in Add mode. All fields are blank.
• student_id extra present: the screen is in Edit mode. Fields are pre-populated from the
database.

The live preview section updates in real-time as grades are typed — it shows the calculated
average, letter grade, and pass/fail status before the student is saved. This helps catch data
entry errors immediately.

Validation on Save checks that name and student number are not empty, that all grade values
are between 0 and 100, and that the student number is unique (a -1 return from addStudent()
triggers a toast error).

3.5 [Link] — The RecyclerView Adapter


Location: adapter/[Link]
This adapter binds student data to each card in the list. Key behaviours:
• Single tap on a card: opens AddEditStudentActivity with the student's id, entering Edit
mode.
• Long press on a card: shows a confirmation dialog asking if the student should be
deleted. On confirmation, the item is removed from the list and database in real-time
without requiring a full reload.
• Letter grade text colour: A = dark green, B = blue, C = orange, D = purple, F = red.
• Status text colour: Pass = green, Fail = red.
• updateList(List): call this to swap in a new list and refresh all visible cards.

3.6 [Link] — Class Statistics


Location: [Link]
This screen queries the database to produce a class-level summary. It shows total student
count, class average, pass/fail counts with a percentage, the top and lowest performing
students by name, and subject-by-subject averages for Mathematics, Science, English, and
History. All values update every time the screen is opened.

4. How to Use the App


4.1 Adding a Student
23. On the home screen, tap the orange + button in the bottom-right corner.
24. Enter the student's Full Name (required).
25. Enter the Student Number (required, must be unique across all students).
26. Enter grades for Mathematics, Science, English, and History (each 0–100). Leaving a
field blank defaults to 0.
27. Watch the Live Preview section update as you type — it shows the average, letter grade,
and status before saving.
28. Tap SAVE STUDENT. You will be returned to the home screen and the new card will
appear in alphabetical order.

4.2 Editing a Student


29. On the home screen, tap any student card.
30. The Add/Edit screen opens with all fields pre-populated.
31. Modify any fields as needed.
32. Tap SAVE STUDENT to confirm changes.

4.3 Deleting a Student


33. On the home screen, press and hold (long press) any student card.
34. A confirmation dialog appears: "Remove [Name] from records?"
35. Tap Delete to permanently remove the student, or Cancel to go back.

4.4 Searching for Students


Type in the search bar at the top of the home screen. The list filters in real-time, matching
against both student names and student numbers. Clear the search bar to show all students
again.

4.5 Viewing Class Statistics


Tap the Info icon in the toolbar (top-right corner of the home screen) to open the Statistics
screen. It shows:
• Total number of students.
• Class average percentage.
• Number and percentage of passing students (average >= 60%).
• Number of failing students.
• Top student name and their average.
• Student who needs the most help and their average.
• Subject averages for each of the four subjects.
5. Grading Scale Reference

Letter Grade Score Range Status Colour in App


A 90 – 100% Pass Dark Green
B 80 – 89% Pass Blue
C 70 – 79% Pass Orange
D 60 – 69% Pass Purple
F 0 – 59% Fail Red

The average is calculated as: (Math + Science + English + History) / 4


To change the pass threshold (default 60), search for >= 60 in [Link] and update the
value.

6. Common Customisations
6.1 Adding More Subjects
36. In [Link]: add a private double field (e.g. privateDouble artGrade), add its getter
and setter, and update getAverage() to include artGrade in the sum and change the
divisor from 4 to 5.
37. In [Link]: add a COL_ART constant, add it to the CREATE_TABLE
string, and include it in the ContentValues in addStudent() and updateStudent(). Also
update cursorToStudent() to read the column.
38. In [Link]: add a new EditText in the XML layout and bind it in
onCreate(). Include it in saveStudent().
39. Increment DB_VERSION in [Link] by 1 to trigger onUpgrade (note: this
deletes existing data on upgrade — for production use, write a proper migration).

6.2 Changing the Colour Scheme


All colours are defined in res/values/[Link]. Change colorPrimary to update the toolbar, FAB
shadow, and section labels. Change colorAccent to update the FAB button colour. The grade
colours (grade_a through grade_d, fail_red, pass_green) can be updated independently.

6.3 Adding a Class/Subject Selector


Add a subjects table to the database, add a spinner to MainActivity, and filter getAllStudents()
with a WHERE clause on a new subject_id column in the students table. This allows managing
multiple classes or subjects independently.
Need to Export Grades?
To export data as a CSV, iterate over getAllStudents() in the database helper, build a comma-
separated string for each student, and use FileOutputStream to write to the Downloads folder. Add
WRITE_EXTERNAL_STORAGE permission to [Link] for devices running Android 9 or
lower.

7. Troubleshooting

Problem Solution
Gradle sync fails with 'unresolved Go to File > Invalidate Caches / Restart. Also check your
dependency' internet connection — Gradle needs to download libraries
on first sync.
Emulator is extremely slow Ensure hardware acceleration (HAXM / Hyper-V / KVM) is
enabled. Increase the emulator RAM to 2 GB in the AVD
settings. Close other heavy applications.
App crashes on launch with Check that all view IDs in Java match the IDs in the XML
NullPointerException layout files exactly. Also confirm [Link]
declares all three Activities.
'Student number already exists' error Each student number must be unique. Check the existing
when saving records — you may be trying to add a duplicate. Change
the student number and try again.
Grades disappear after reinstalling the This is expected — the SQLite database is stored in the
app app's private storage and is deleted on uninstall. Implement
an export/import feature to preserve data.
Search bar not filtering results Make sure the TextWatcher is attached to the correct
EditText ID (searchBar) and that searchStudents() is
returning results. Add a Log.d() call to verify.
Build error: 'cannot find symbol' for a Right-click the java folder > New > Package and ensure the
class package name matches [Link]
exactly. Check for typos in the package declaration at the
top of each file.

Student Grading App — Android Studio Developer Guide

You might also like