Android tricks - How to compare two drawables?

Drawables are widely used throughout the developing process of Android applications. Because of one reason, or another we can be interested in comparing two drawable objects. At first, that sounds like an easy task, but actually it can be a bit tricky. The ‘==’ operator Of course, if you have two different instances of the same drawable resource, the ‘==’ operator is useless. It’s gonna compare if the left and the right side are actually the same instance....

February 15, 2017 · 3 min · Todor Kostov

Android tricks - How to determine the current state of your SearchView?

The SearchView provides a way for the user to enter a search query and submit it to a search provider. It’s a widely used UI pattern in the Android system. Though, a simple task like figuring out if the search box is currently visible can be a bit tricky. On the image below, you can see the two possible states for a SearchView. On the left one, the view is closed....

February 10, 2017 · 2 min · Todor Kostov

RecyclerView & ListView basic comparison

Do you remember the good old ListView? Back then it was the only option for showing items in scrolling lists. Then, at some point, a new player entered the field - the RecyclerView. For some period of time I was definitely confused about which one should I use. But day by day the RecyclerView took the whole stage and there was almost nothing left for the old ListView. Nowadays, if you need a listing functionality, the RecyclerView is the place to go....

February 5, 2017 · 5 min · Todor Kostov

Android tricks - Is there a way to customize the permissions dialog?

With Android 6.0 Marshmallow a really important feature was introduced to the Android users. Yes! I’m talking about the run-time permissions. The “all or nothing” approach related to the app’s permissions was wiped out. If running on Marshmallow or a later version, the users can enable and disable permissions whenever they want. And that’s how the nightmare for all of us, the developers, began! When going through this nightmare, have you asked yourself, if it is possible to change the UI of the dialog?...

February 1, 2017 · 2 min · Todor Kostov

Android tricks - How to add strikethrough text in TextView

The strikethrough effect can be really useful in many situations. You can use it when you want to show a discount price, when you want to mark a wrong word or in many other situations. We all know that feature from software products like Word, Evernote, Sublime, etc. But how can we do the same thing with our simple TextView? There are two different ways to do that, based on the desired result....

January 25, 2017 · 2 min · Todor Kostov