Image for post
Image for post

Mobiles are now available in a variety of sizes, which is why it is so significant to provide a flexible and responsive UI. We need to design the user interface of our app completely flexible so that it is displayed correctly on all devices. This article will show you how to support different screen sizes using the tools available in Android (For other devices such as Android wear, TV,… we have to take more steps).

You can also see Responsive UI code implementation in my GitHub.

The best way to create a responsive UI is to use ConstraintLayout as our base layout file because, in ConstraintLayout, we can specify the position and size for each view according to spatial relationships with other views in the layout. We can convert LinearLayout to Constraint or use the layout_weight option to make the UI flexible(but in nested LinearLayout it slows our UI performance). …


Image for post
Image for post

In this article, I am going to create a sample project (app) that will help us understand Clean Architecture. This project is an application that the first page shows you a list of data characters which are in the Rick and Morty series, and by clicking on each character, the next page shows you the episodes those characters are in.

By this explanation, it shows that we have two types of existence. The character and the episode.

So in the first place, why do we want to use clean architecture?

  1. Separation of Concerns —Separation of code in different modules or sections with specific responsibilities makes it easier for maintenance and further modification. …


Image for post
Image for post

Models are the most used classes in java. When you want to create an object with a different configuration How do you define the modal class to create the object easily? There are 3 ways to do that: telescoping constructor, Java Bean pattern, and Builder pattern, and the first way is an anti-pattern. When the model class has optional fields, the first way creates more constructors so we use the builder pattern to solve this problem. Below, each will be explained.

1.Telescoping Constructor: Traditionally, programmers have used the telescoping constructor pattern in which they provide a constructor with only the required parameters, another with a single optional parameter, or one with two optional parameters, etc. This way is safe but it creates many constructors. Imagine you have 5 fields and 3 of them are optional. So you have to create 4 constructors.

About

Golnaz Torabi

Junior Android developer, Interested in learning new content

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store