How-To

Learn how to use Kotlin delegates to defer your interface implementation and reduce code!

Kotlin supports a beautiful feature called delegation. According to the docs:

Kotlin supports “delegation” design pattern by introducing a new keyword “by”. Using this keyword or delegation methodology, Kotlin allows the derived class to access all the implemented public methods of an interface through a specific object.

Key points from this:

  1. Delegation is achieved using ‘by’
  2. The derived class can access all the public methods of an interface via an object.

Ok, so what does it mean?

Let me explain in detail.

Use-Case: We want access to the currently signed in user from the UI to show the user’s name (let’s say). …


Android

Google has released this very easy to use library to store shared preferences securely

At some point in time of your Android Development, you’ll be faced with this problem, is my app secure? Am I storing the important stuff securely? If you’re not faced with these questions, then you should.

Store server JWT token

These days, servers are becoming stateless where the server doesn’t remember who you are and what is your authentication status. So, the clients have to send a token, or some authentication on each API call to authenticate.

The first time a user logs in, the server sends a token back to the client. This needs to be preserved by the client, securely. If someone…


Android

How to access Retrofit or custom parameters in an Android RxWorker class. I’ll guide you step by step how we can achieve that using Dagger. Read on!

WorkManager is the latest solution by google which is very helpful in running background tasks. Under the hood it uses a combination of JobScheduler (API 23+) and BroadcastReceiver + AlarmManager (API 14–22). This basically creates a very powerful solution for scheduling or performing immediate background tasks along with constraints like Network, Disk Space etc. If you’re not familiar about the WorkManager, I suggest you do a WorkManager Codelab first.

Before we start, this article is for people who are familiar with Dagger 2 and have implemented Dagger 2 in their project.

That being said, we not here to discuss WorkManager…


Android

If you’re building an application that has a considerable amount of local database usage with a lot of tables, you will come across this problem at least once where you need to write custom queries

Room Database is an excellent solution by Google which makes our life a lot easier using the Sqlite Database on Android Devices. It uses the approach of Spring style JPA objects called Entities and it does it very well. At the ground level,each entity object = 1 table in the database. It can even handle joins and nested objects very well using @Relations and @Embedded annotations.

But what about custom queries and custom objects which don’t necessarily point to a single table? Let’s find out how.

Enter @RawQuery

The official docs say,

RawQuery serves as an escape hatch where you can build…


Android

Improve your development time by trying out these neat tricks to control the memory hog Android Studio. Read on!

We all have been there. This journey of patience endurance starts from the moment you click on that dreaded Android Studio icon.

And obviously we cannot forget the classic :


Tools

I have rounded up the top 10 frameworks across various domains that a developer/project manager/leader should be aware of

Each year we look forward to our tech community for the immense contributions, disruptive technologies (link to another blog), and innovation. Technology in itself is a very broad term; it can be tools, products, concepts, frameworks. I have rounded up the top 10 frameworks across various domains that a developer/project manager/leader should be aware of:

GatsbyJS

It is a web-based framework based on React and GraphQL used to build websites. It has its own syntax (sort of) which works with HTML, CSS, and JS. It is said to build “static websites” with ease. It follows the JAMstack architecture; a combination of…


Android: Woes of an end user and a developer.

Disclaimer: First time writing a blog so bear with my content.

I write this as I am factory resetting my HTC One M7, once a ‘flagship’ with x number of cores, 2 GB RAM etc etc. Well, no longer a flagship, why? Not because it lost a core or a GB of RAM got damaged and it managed to downgrade on its own. …

Udayaditya Barua

Coffee aficionado | Proud Entrepreneur | Food fan | Coding Ninja | Gamer | Beer Geek | Problem Solver

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