A4: Mobile Layout (Java/Android) -- Notepad


You will create an interactive mobile application that allows users to create, modify and delete text notes. The whole application should respond to device orientation.

Learning Goals

This assignment gives you an opportunity to build an interactive mobile application, and gain experience managing dynamic layout on a mobile device.



Design and implement a mobile application called Notepad, which allows users to display, create, edit and delete notes. The application should have two different views: one that displays all the notes and one to type in text. The application should look something like this:

Main Activity Edit Note

When first launched, the application should show a scrollable list (RecyclerView) with all the existent notes thumbnails. The notes thumbnails should be displayed from the newest to the oldest.

For each thumbnail in the list, the title is displayed in bold and larger font, the first 15 characters of the first line of the note in gray below the title and a bin icon to delete the note. If the title is too long, it should be truncated. If the note has no title, the first 10 characters of the content should be displayed.

A button in the layout should be used to create a new note and open an activity to edit it.

The thumbnails in the list are well separated from each other by a line divider.

When touching a note thumbnail in the list, it opens a Activity to edit the associated note.

The edit Activity allows users to type a title, content and save a note. The content EditText is scrollable when text is long. Tapping the previous button saves the current note and reopens the main Activity with the list. If there is no title and no content typed (string is empty) when the previous button is pressed, the note is deleted. There is also a Save button that saves the note and goes back to the main Activity.

Your application should not hang or freeze-up when loading the note. Consider loading the text in the background to prevent this problem for large notes (>500 characters and under 5000 characters). Display the first 500 characters (for example) when opening the edit activity and load the rest of the note in background. See hints below.

The notes are persistent. If you create a note then close the app and reopen it, the note will appear in the list at startup.

Supported Layouts

You need to support two layouts: one that is shown when the phone is held vertically, and one when it is held horizontally. The user does not manually change the layout, but instead your application should respond to changes in phone orientation so that the appropriate layout is always shown. No data should be lost when the phone is rotated (note: the emulator uses a hotkey to change orientation, typically Ctrl-F11). When typing a note and changing orientation, text already typed should not be lost.

Technical Requirements

Getting Started

To setup your environment and create a new porject, you can follow this tutorial.

Here's some suggestions if you're new to Android and mobile development.

  1. Create your project (recommended to use the "Empty" project). Setup your AVD, and configure the project to launch and run in the AVD. Projects are very difficult to get setup and build properly, so you want to make sure it's working before you start modifying anything.
  2. Commit and push changes to Git frequently! Anytime you make a substantial change (and your code compiles/works), then commit and push to Git.
  3. Android will handle the orientation change for you but make sure to save and restore data during the orientation change.
  4. Create a Main activity for your list and a second one to write or modify a note. Use intents or a shared model to pass information between these activities.
  5. Use a RecyclerView to display the notes thumbnails check the Android tutorial for this: RecyclerView tutorial.
  6. In Android, you have different places to store data. For this assignment, since the notes are only visible from the Notepad app, use only the internal storage. To store and access the app specific internal files and directory
  7. Consider using an AsyncTask to fetch data in the background. To test it, you can just load the first 2 characters and load the rest in background.


Your directory structure for your assignment submission should be in subdirectories under your a4/ directory in your Git repository. It should use a standard file layout for an Android IntelliJ project.

Your submission needs to include:

Your `readme.md' file needs to include, at a minimum:


Late assignments will not be accepted. Markers will test your application by running your APK file against a Pixel AVD. Your submission will be assessed roughly as follows (detailed marking scheme to follow):

Code compiles and runs, readme, working project.
Application loads, and screen includes the create note button.
Notes with their title content and delete button are shown in a scrollable list.
User can create and delete notes.
Tapping a thumbnail opens the edit note activity with the title and content of the note.
Changing the orientation when in the edit note activity keeps the current text and title.


1.0. Mar 3, 2020. Initial release.

1.0. Mar 5, 2020. Clarified the SDK version.