Build a simple MoodTracker app for an android platform.

MoodTracker App is majorly inspired by Mr. Mood for iOS. The idea is simple: every day, you record your mood within the application.

Mutwakil Mo
AndroidPub

--

MoodTracker icon app

Howdy, I’m Mutwakil Mo,

I’m an Android Developer student at OpenClassrooms living in Brussels, Belgium.

OpenClassrooms is an official private distance learning establishment registered with the Board of Education in Paris, France, that grants its own diplomas as well as those of prestigious academic partners.

Upon completion of the studies and validation of my skills by an academic jury, I will earn a “Web developer (Développeur(euse) d’application)” bachelors-level diploma, registered with the National Directory of Professional Certifications (RNCP). This diploma is at level 6 on the EQF (European Qualifications Framework).

I am also a fan of technology, design, and entrepreneurship and interested in arts.

I would like to thank my mentor at Openclassrooms Patil Bapusaheb for all his support, encouragement, and guidance.

Ok, let’s start now…

MoodTracker app is the first android app I launched on the Google play store.

MoodTracker App is majorly inspired by Mr. Mood for iOS. The idea is simple: every day, you record your mood within the application. If you want, you can add a note to give more information on why you’re feeling a certain way (ex. “I got a new job! 😃” or “There was no cheesecake left for dessert 😞 “). Your mood history is saved for a week, allowing you to see your general mood trends. Any comment you’ve left can also be consulted.

To install the Moodtracker app click on the icon below or visit MoodTracker website. For the MoodTracker project source code visit MoodTracker repository on Github.

MoodTracker design Mockup

Alright then!!

First Create a project MoodTracker in Android Studio and then select an empty activity.

Click the Finish button. Android Studio will display a window titled, Building ‘MoodTracker’ Gradle project info, complete with a loading bar. After it finishes downloading and preparing the necessary files, Android Studio will reveal the main screen.

Explore MoodTracker app structure

Manifests Directory

This directory usually contains only one file: the AndroidManifest.xml file. This file represents your application’s identity. Among other things, it allows you to specify the name of the application, the MoodTracker package, the icon to display, or which Activity to launch at startup.

Java Directory

This directory contains all the Java (or Kotlin if you choose to build MoodTracker with it) application source code, as well as any associated tests. In our example, we see the MainActivity file (the .java extension is automatically hidden by the IDE). As the project progresses, we will fill this directory with files and sub-directories in order to isolate functional components.

Res Directory

This directory contains all the application’s resources and includes four sub-directories:

  • Drawable folder: contains all the images and contents displayed on the screen (for example, a graphic, logo, icon, etc.)
  • Layout folder: contains all the layout files of your application
  • Mipmap folder: stores the application icon
  • Values folder: contains various settings and values (for example the colors we use in the application), alternative translations for written text, graphical styles to apply, and more.

Ok then, Let’s create the Layout files…

activity_main.xml

activity_mood_history.xml

item_mood.xml

activity_intro.xml

layout_screen.xml

3- Open build.gardle and add the reyclerview library to dependencies…

Under the res, directory creates anim folder then create button_animation.xml and add the following lines of code…

4- Open the color.xml and add the following…

5- Open the string.xml and the following …

6- Open the styles.xml and change the style theme to the following…

7- Add MoodTracker images to the drawable folder

8- Create a raw folder and add your Mood tune. You can play a sound effect upon selecting a particular mood. Of course, we need mother java to make it work😃.

9- Create an app icon for MoodTracker app.

MoodTracker app icon

Now let’s switch to the Java part…

Add the following code to your MainActivity.java

MoodHistoryActivity.java

Constants.java

Let’s create a MoodAdapter for the History mood screen and call it MoodAdapter.java

SharedPreferencesHelper.java

UpdateDayReciver.java

ScreenItem.java

IntroActivity.java

IntroViewPagerAdapter.java

Well done Babydoo!!

Now it’s time to run your MoodTracker app and choose your mood.

--

--

Mutwakil Mo
AndroidPub

I’m an Software Engineer living in Brussels, Belgium. I’m passionate about design, technology, and entrepreneurship. https://www.linkedin.com/in/mutwakil-mo/