
Final Project Overview
Estimated time: 3 minutes
Project description
In this project, you will develop a mobile application that tracks
daily fitness activities, such as the steps taken and calories burned.
Through this project, you will gain a solid understanding of mobile app
design, user interface creation, and implementation of fitness tracking
features.
Objectives
After completing this reading, you will be able to:
Apply the basic concepts of mobile app design
Create user-friendly interfaces for fitness-tracking
apps
Create activities that contain business logic for the
app
Implement user stories in the app
Key features
- Track daily fitness activities like the steps taken and calories
burned
- Validate user input to ensure required fields are filled
- Navigate between different screens (activities) within the app
Concepts
- View/ViewGroups: Understanding and using various
views and view groups to structure the app
- Layouts: Designing intuitive and responsive layouts
using LinearLayout
- Navigation: Implementing navigation between
activities using Intents
- Material Design: Applying material design
principles to enhance the user interface
- Click Events: Handling click events for buttons and
other interactive elements
- User Input Validation: Ensuring required fields are
filled before proceeding
- Emulator Testing: Using an emulator to test and
debug the app
Technical terms
- Activity: Single screen with a user interface
- Intent: Abstract description of an operation to be
performed
- findViewById: Method used to retrieve a view by its
ID
- setOnClickListener: Method used to set a callback
for when a view is clicked
- startActivity: Method used to start a new
activity
- Toast: Small message that pops up on the
screen
- Toast.makeText: Method used to create a toast
message
- LinearLayout: View group that aligns all child
widgets in a single direction, either vertically or horizontally
- Android Studio: For app development
- Emulator: To test the app
Instructions
Your task is to implement the following user stories in this project.
A user story is an informal, straightforward description of a software
feature from the end user's perspective. It aims to explain how the
feature will offer value to the user.
User stories
- As a user, I want to enter the number of steps I have taken to track
my daily activity.
- As a user, I want to enter my weight and age to get a more accurate
calculation of the calories burned.
- As a user, I want to see the calories I have burned based on my
steps, weight, and age to monitor my fitness progress.
- As a user, I want to navigate back to the main screen from the
Calories screen to enter new data if required.
Approach
Follow these seven steps to create the Daily Fitness Tracker App.
Step 1: Create a
new project in Android Studio
- Create a new project in Android Studio with an empty activity.
Step 2: Create the main
activity layout
- Design the main screen layout (activity_main.xml) with:
- A title text view
- An input field for the number of steps
- A button to calculate calories
Step 3: Create the
calories activity layout
- Create a new "Empty Views Activity" named CaloriesActivity.
- This will generate a new Java file (CaloriesActivity.java) and a
corresponding XML layout file (activity_calories.xml).
Step 4: Update the
MainActivity.java file
- Add logic to open the caloriesActivity when the user selects the
Calculate button.
- Pass the number of steps to the caloriesActivity by adding to the
Intent.
Step 5:
Implement the CaloriesActivity.java file
- Implement logic to receive Intent from the MainActivity and extract
the number of steps.
- Implement the calculateCalories method, which calculates the number
of calories based on the provided formula.
Step 6: Update the
AndroidManifest.xml file
- Ensure all activities are listed in the manifest file.
Step 7: Run the application
- Ensure your Android virtual device (AVD) is set up and select the
Run button.
- Verify that the main screen appears, and on entering the steps taken
and selecting Calculate Calories, you are taken to the
Calories screen displaying the calculated calories burned. Ensure that
the Back button navigates to the main activity and that the toast
message is displayed if no steps are entered.
Author
UL