Image for post
Image for post
https://unsplash.com/photos/ZV_64LdGoao

Creating open-source Android libraries benefits for both library owner and the other developers. A code written by a developer can save other developers from building the same thing, and also the other developers can contribute the same code. Thus, a library that will be useful for many people is can be created with the contribution of a few people.

However, you may not want to open some of your personal or corporate libraries to the outside world. In this case, you can create your own packages using one of GitHub, GitLab, AWS, GCP etc. services.

Reusability and Versioning

When you have multiple projects that use shared components, implementing a single main code for these projects instead of using the same code in all projects will benefit you in many ways. It is important to make bug fix or code change in a single library and create a new version, both in terms of spending less time and ensuring consistent build quality. …


Android Shared Preferences is best and easy way of the key-value storage. It also provides callback to listen changes in the preference values. However, can we make this use more suitable for our architecture?

Image for post
Image for post

Let’s imagine we have an Android application and it storages some feature status data (like open-closed) in the shared preferences. Multiple fragments of application has indicators which are showing that feature status and we want to see changes immediately. Each indicator is getting status of feature from shared preferences. Additionally, this feature status can also be updated in some service or broadcast receiver.

We can use OnSharedPreferenceChangeListener to listen changes in the preferences but as you can see, we have to check every possible key changes in the when statement and we need to register and unregister listener in every fragment we listen in. Additionally, it doesn’t look good and clean. We can do better! …


Image for post
Image for post

I used to work with MVP pattern until now. However, when Google released nice-to-use components like the ViewModel along with the Android Jetpack, I have tried to work with MVVM pattern. In this article, we will see how can we use the MVVM pattern with Retrofit, RxJava, and Dagger 2.

What is MVVM?

Model-View-ViewModel architecture consists of 3 parts.

  • The View gets user’s actions and sends to the ViewModel, or listens live data stream from the ViewModel and provides to the users.
  • The ViewModel gets user’s actions from the View or provides data to View.
  • The Model abstracts the data source. View and ViewModel uses that on data stream. …

About

İbrahim Süren

Golang & Android Dev.

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