Anim Button – Inspired by Whatsapp

In some of the popular chat applications like whatsapp or hangouts, there is a button which can be transformed into a record button and also when you enter some text it will transform into a send button.

AnimButton is a custom ImageButton which is imitating the whatsapp’s send button behavior. Basically, it will change the image source when you enter some text on the edittext and it will go back when you clear the edittext

In this post I will try to mimic this behavior in my AnimButton project. Also, the full source code of the project can be found on the Github.

Continue reading Anim Button – Inspired by Whatsapp

SparseArray vs HashMap

Main purpose of SparseArray in Android development is to have a memory efficient integer to object mapping.

It is not solely about to gain a performance tweak, however, you will save much more memory by using SparseArray.

Benefits of SparseArray

  • Saves you memory (Less memory usage thanks to the primitive keys and no Entry objects)
  • No auto-boxing (Because the keys are primitives e.g. int vs Integer, it will not convert your key to a new Integer(key))
  • Less time spend in GC-Garbage Collection- (With auto boxing there will be redundant Integer and Entry objects in the memory which needs to be collected by GC after their usage end)

Continue reading SparseArray vs HashMap