Guessing Game

Current Status

Not Enrolled



Get Started

Reading Time: < 1 minute

In this tutorial, we are going to build up a simple guessing game. First, a short introduction to the game. The essence of the game is to figure out a hidden, randomly generated number. This number is between 1 and 10. We have endless possibilities to try.

From Android development side, we are going to use in this tutorial 2 Jetpack libraries, which are the Data Binding and the Navigaion Component. Then, we will use the MVVM design pattern, together with LiveData and ViewModel.

In our app, we will have only one Activity. This activity will hold a fragment, where we will define the view of the game and from this fragment we can open a bottom sheet dialog also.

Former knowledge

This tutorial assumes that you have former knowledge about Android development and you are familiar with the basics of the Android Jetpack componenets.

If you need some knowledge update about the basics of Data Binding, then check out the Data Binding – Basics tutorial.

In this tutorial, we are going to use Navigation Component as well. If you need to refresh the usage of this library either, then here is a tutorial also: Navigation Component

The sample app


      1. Introduction
      2. Preparation
        1. UI
        2. Enable Data Binding
        3. Transform the layouts
      3. Navigation Component
        1. Open the Bottom Sheet Dialog 
      4. ViewModel
        1. Change the username 
        2. Real time update using layout variables
        3. PlayerViewModel
      5. Play the game
        1. GameViewModel
        2. Define the LiveDatas
        3. Creation of the business logic
        4. Result of the guess
      6. Binding Adapters
        1. Show the result
        2. Visualize the result


I hope the description was understandable and clear. But, if you have still questions, then leave me comments below! 😉

See you in the course! 🙂

Follow and like us:

Click to rate this post!
[Total: 0 Average: 0]

Leave a comment

stay informed!

Subscribe to receive exclusive content and notifications