With Android Architecture Components getting a stable 1.0 version, there are now no excuses of not using it 🙂 Along with handling lifecycle events, realtime data updates in UI (ViewModel with LiveData) and pagination of loaded data (Paging), comes Room – small, yet powerful SQLite ORM. In this post I’m gonna demonstrate its core capabilities on an example Android application.
Remember those times implementing SQLiteOpenHelper and checking SQL queries in run-time? Good news is that you don’t have to do it anymore! Room performs compile-time checks on your SQL queries and you don’t have to write any SQLite code which is not in a direct relation with your data queries. Great, lets use it!
First of all, Room is a part of Architecture Components, which means it works really well with ViewModel, LiveData and Paging (but does not depend on them!). Also, RxJava and Kotlin are perfectly fine too. In order to add Room to the project, I’m adding the following lines in app’s build.gradle file:
Check for the latest library version here.
Additionally, provide a location of DB’s schema in defaultConfig scope. This way you can always check how it looks, maybe decide to modify your tables once you notice something in scheme.
arguments = ["room.schemaLocation":
Continue reading Database example app with Room ORM
It’s been a long time since I talked about my app’s release, but finally this day came! Today, I want to present you Look Counter – a simple app for counting how many times a day you have turned on and unlocked your phone (or tablet). It counts this in background and displays the latest numbers on the main view. You, as a user, can delete this data at any moment of time (Clear all Data option, with a quick Undo if you change your mind).
I’ve put an About view, if somebody is confused with the minimalist design and doesn’t follow what those numbers in circles mean, or maybe, wants to contact me right away, and say that counting doesn’t work for him at all! 😛
Anyway, the source code is on GitHub, so you can check what’s inside and grab tasty pieces, as well as point me at my mistakes 😉
Continue reading Look Counter app and more!
Today’s post will be short. I just wanted to announce my new very simple widget – WiFi Switch Widget. Basically this is just a half of my previous widget – WiFi & Mobile Data Switch.
Answering the question Why?, I’d say Sometimes there is no need for Mobile Data switch, for example not all tablets have 3G module. This is one possible answer. Another one is that I did it for myself. Yes, there are plenty of similar widgets/apps, but I wanted to have my very own too ^^
Do I really think it’s useful? Not as much as my previous apps. Will it find its users? I don’t know. I hope so 🙂
Continue reading Yet another “switch” widget…
It’s been a long time since my last post 🙂 Nevertheless, I wanted to write about my first Android widget that I have published on Google Play. It’s called WiFi & Mobile Data Switch Widget and it does exactly what the title suggests – switches WiFi & MD ON or OFF. It is very useful as you have both of these actions in one place and don’t need two widgets or, what is even worse, jump to Settings.
What are the advantages of such widget? First of all, you see what is the state of WiFi and Mobile data at a current time. Second, you have a better control of connections and a very convenient one, – the widget is available on Lockscreen as well! Finally, turning WiFi or MD only when you need it and without even unlocking your phone/tablet, saves a battery life and this is a big plus! 😉
Give this widget a try and it will serve you well.
Thank You for reading!