Date Archives

May 2015

Android Custom ListView

This tutorial covers ‘Advanced’ custom listview concepts. The code is available on Github.

Android Hive provides an awesome tutorial on how to create a custom list view but you can still take things a notch higher and create a ListView like what Whatsapp or Telegram use. Their Lists allow you to click on either the contact or the profile picture.

Final Result

By the end of it we will be able to click on an item on the list eg the image. Below is the final output.


Enough talk..let’s code.

Tools of Trade

  1. RecyclerView: Our list will extend RecyclerView instead of BaseAdapter. RecyclerView is more flexible that ListView and has a better perefomance.  For more info check out
  2. Viewholder Pattern: This pattern consists of a simple class that holds the references to the UI components for each row in the ListView. This pattern avoids looking up the UI components all the time the system shows a row in the list.

Let’s get our hands dirty 🙂

1. We need to add RecyclerView dependency in our gradle file.

2. Creating a RecyclerView is very similar to the ListView.

3. In onCreate we setup the recyclerview.

4. Now create under model package. This model class will be used to provide movie objects data to listview after parsing the json.

5. Create a class named with below code. This is a custom list adapter class which provides data to list view. In other words it renders the movie_item_layout.xml in list by pre-filling appropriate information. This adapter must extend a class called RecyclerView.Adapter passing our class that implements the ViewHolder pattern. We then to define our data model that stands at the base of our UI that implements the ViewHolder design pattern.

6. I created a method onMemberClick() that handles onClick behavior when the add/remove button is clicked.

7. In the,I created volley’s JsonArrayRequest to get the json from url. Upon parsing the json, I stored all the json data into an ArrayList as Movie objects.


That is all folks. If you have any questions, comment below. If you have a better way of doing it, please, help me out.





Warning: This blog contains thoughts of a free and curios spirit. Proceed with caution 😛

Truecaller is an “Awesome” app I must say. Most of my friends use it, but not me. There are a couple of flags and I will show you why I don’t have it installed.


Truecaller helps identify unknown calls with Caller ID, blocks unwanted spam, scam calls all over the world reported by our users.(You)

* See who is calling if you don’t have their number in your phonebook
* Block unwanted calls from spam callers and telemarketers
* Search for any number in the world to see who it belongs to
* You can now copy a number anywhere (e.g. website or apps) and Truecaller will notify you who it belongs to
* Get in touch with people via name search (Premium feature)
* Tweet and Follow a person on Twitter directly from Truecaller
* Yelp! integration for faster business search results
* + more features to make your phone smarter

Whenever an unknown number calls you, if your GPRS/wifi is active, this app shows you the name of that caller. You can also go to their site and search for a number. You need to login with Facebook, Windows Live Yahoo or Google Plus. Cool features, yes? Well ladies and gentlemen, sorry to burst your bubble but you actually help Truecaller help you.

Red Flags

1. How Do They Get Their Info?

Don’t just use apps just because you are told they are awesome. Question everything.

Truecaller NEVER uploads your phonebook to make it searchable or public. 3G or WIFI is required for Truecaller Caller ID to work. Operator charges may apply.” That is what they tell you.

Truecaller Never UPLOADS… Let’s pause for a second or two.. Okay let it sink in. What do they mean by that. I mean, this is so vague but if they were honest, they would not be in business now.

So how do they get a users name? e.g When a strange number 0724 *** *** calls, you will be informed that “Julius Caesar” is calling.

This is how I ‘think’ they do it.

  1. I save 0724 *** *** as “Julius Caesar”.
  2. Once I install Truecaller, ALL my contacts are synced to TrueCallers database.
  3. You install TrueCaller and process 2 is repeated.
  4. “Julius Caesar” calls you but you don’t know if the aliens are trying to make contact so Truecaller verifies that by looking for 0724 *** *** in their database.
  5. You are in luck, it’s not the aliens but “Julius Caesar” and thanks to “me” Truecaller tells you who it is.

You have to hand it to the guys behind Truecaller. This is what they say on the Description section.

2. Why so many permissions?

Let’s begin

The Permission Nest:

Now this ladies and gentlemen, makes my jaw drop. Look at all those permissions..


 A. Photos/Media/Files:

Some of you will argue that this permission is required to get the contact info. I tend to disagree. Truecaller is meant to help you find out who is calling, or at least that is what they say. So I don’t know why they need to access your Photos, Videos Audio and SD card.


B. Location:

Truecaller helps you find the location of the caller. What if Truecaller gets your location? Think of the information they will have on you. Person X likes hanging out at Restaurant Y for 2 hours every Saturday……… *Evil Laugh*


C. Call Log

Truecaller gets access to your call log. *Clears throat*.  Person X always calls number 0724 *** *** at 8:00 PM of 20 mins everyday. ……


D. Bluetooth Connection Information

Why the hell do they need Bluetooth permission? This permission allows the App (Truecaller) to control Bluetooth, including broadcasting to or getting information about nearby Bluetooth devices.



Don’t get me wrong. Truecaller is an awesome application BUT it has a lot happening  under the hood. Truecaller exists because you and 1,000,000 + 1 users clicked install.

Before you click install, go through the permissions. If you are not sure Google or ask. Once you click install, you accept the terms and conditions.