Welcome to this series of blog posts where I will be creating modern Android app using best tools and practices available in year 2018. I am doing this because I want to cover all main hottest topics in Android world and acquire knowledge in them by teaching you. If you follow this series you will learn how the app is being developed from the scratch. Each blog post from this series will cover some specific development topic which I want to talk about. I will try to do my best to create good quality app and explain you development process. This first blog post from the series is a project’s roadmap of what we are going to do.
This introduction part will be updated constantly as I will progress through different parts of blog posts series.
- Introduction: Roadmap to build modern Android app in 2018 (you’re here)
- Part 1: SOLID principles
- Part 2: Mockups, UI, XML layouts
- Part 3: Architecture patterns MVC, MVP, MVVM with Android Architecture Components – ViewModel, LiveData, Data Binding, Room
- Part 4: Dependency Injection with Dagger 2
- Part 5: Handle RESTful Web Services using Retrofit, OkHttp, Gson and Glide (COMING UP NEXT!)
The app “My Crypto Coins” idea
At first it was hard to think an idea to showcase all Android development trends but finally I found one which I really like. It is related to my huge interest area – blockchain and cryptocurrencies. I decided to create an app which would be your portfolio of what cryptocurrencies you hold and let you know how much they are worth converted to fiat money. The important thing for the user is that this app is going to ensure 100% trust as it will not require any login/registration process and won’t collect users’ data by sending it to the server. I guess nobody would feel comfortable sharing information online about owned money. Users’ provided data about cryptocurrency investments will be only stored inside local database that is kept inside Android device. However to know portfolio value converted to the fiat money, app is going to use internet to get the latest conversion rates. So as you see for training purpose this app idea is great as it is technically challenging you to try different approaches to work with data, which is one of the most important skills to know to build modern apps. Money topic for people is so sensitive information, that is why to ensure even more trust I will be developing this app openly by creating blog posts series and making project code available for everyone to see that there is nothing to hide.
What we are going to use?
First in order to create this app we need to know various cryptocurrencies prices at current moment. This data will be provided from the internet as it is constantly changing.
CoinMarketCap – one of the most popular websites for getting an overview of the cryptocurrency market. This website offers own free API that anyone can use and it fits perfectly for us as data service provider.
Next I made a list of most significant to my mind trending things in Android world that fits well this project and should be used in it.
Kotlin – an official language on Android, which is expressive, concise, and powerful. Best of all, it’s interoperable with existing Android languages and runtime. This new language introduction was one of the hottest topics in 2017 for Android, so our app definitely needs to be written in it. I also talk about Kotlin and its features in my past blog post “Let’s learn Kotlin by building Android calculator app“.
Integrated development environment (IDE):
Android Studio – an official IDE for Android, which provides the fastest tools for building apps on every type of Android device. There is no better alternatives for building native apps, so it’s our main choice as IDE without any questions.
Project build management system:
Gradle – is an advanced general purpose build management system based on Groovy and Kotlin, which supports the automatic download and configuration of dependencies or other libraries. It’s recommended build system by Google and is well integrated inside Android Studio, so we will be using it.
Android Architecture Components – a collection of libraries that help you design robust, testable, and maintainable apps.
Model–View–ViewModel (MVVM) – it’s an architectural pattern, which concept is to separate data presentation logic from business logic by moving it into particular class for a clear distinction. This pattern is being pushed by Android team as default choice. Also it’s alternative to MVC and popular MVP patterns. I’ll be talking separately in this series about this pattern choice, other architecture options and how to organize our code well in general. It is very important if we want to build easily maintainable solid project.
SQLite Database – it is an opensource SQL database that stores data persistently to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features.
Shared Preferences – it is an API from Android SDK to store and retrieve application preferences. SharedPreferences are simply sets of data values stored persistently that allow you to save and retrieve data in the form of key, value pair.
Android Jetpack components:
AppCompat – it is a set of support libraries which can be used to make the apps developed with newer versions work with older versions.
Android KTX – a set of Kotlin extensions for Android app development. The goal of Android KTX is to make Android development with Kotlin more concise, pleasant, and idiomatic by leveraging the features of the language such as extension functions/properties, lambdas, named parameters, and parameter defaults.
Data Binding – is support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
Lifecycles – for managing your activity and fragment lifecycles.
LiveData – is an observable data holder class which was designed to help solve common Android Lifecycle challenges and to make apps more maintainable and testable.
Room – it provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.
ViewModel – it is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
ConstraintLayout – it is for building flexible and efficient layouts. The Layout Editor uses constraints to determine the position of a UI element within the layout. A constraint represents a connection or alignment to another view, the parent layout, or an invisible guideline.
CardView – element which represent the information in a card manner with a drop shadow (elevation) and corner radius which looks consistent across the platform.
RecyclerView – it is flexible and efficient version of ListView. It is an container for rendering larger data set of views that can be recycled and scrolled very efficiently.
Dagger 2 – this is a fully static, compile-time dependency injection framework for both Java and Android.
Retrofit 2 – it is an open source type-safe HTTP client for Android and Java. With Retrofit we can compose the HTTP connection easily through a simple expressive interface just like an API document.
OkHttp – it is an open source modern, fast and efficient HTTP client which supports HTTP/2 and SPDY.
Gson – it is an open source Java library to serialize and deserialize Java objects to and from JSON.
Glide – is a fast and efficient image loading library for Android focused on smooth scrolling. Glide offers an easy to use API, a performant and extensible resource decoding pipeline and automatic resource pooling.
Configuring new project
This project is going to be started from the scratch. So I’ll launch Android Studio, create a new Project, name it “My Crypto Coins” and select “Basic Activity”. At this point there is nothing special to discuss, because our goal is just to make fresh clean start and avoid any complexity in our minds by adding additional features (e.g., instant app support). We could add anything later if we want during development process. For the start let’s just include Kotlin language support and target API 23: Android 6.0 (Marshmallow). Why I am not targeting lower or higher API? Let’s face it, it’s so nice to cut the support for some older devices and don’t worry about many compatibility issues during development. Also I am a proud owner of old Nexus 7 (2013) tablet, which is running Android 6.0.1 and I hope to test my app live on it. 🙂 So for this individual project that impacted my minimum SDK choice even correctness of that is always questionable. Also as you noticed I am going to ask IDE to add automatically generated basic activity with fragment support and floating action button because I feel all that could be useful for our project.
GitHub – one of the most popular web-based hosting service for version control. This is open source project and of course I will be using it. All the blog posts from this series will have its own commits made as separate branches and the master branch for the latest source code version. Here is a link for you to the repository.
That’s it for the start. If you have any questions, suggestions, remarks to make, please feel free to do that in comments. And now let’s learn together! 😉