Inflating different xml layouts in an Android ListView for different Objects.

While working on the Ambient Dynamix Project, I needed to create a listview which contains a non fixed number of headers each one followed by some list items. A common solution is to use the MergeAdapter. A MergeAdapter object exposes the addAdapter(), addView() and addViews() methods. The demo included in the repo is pretty self… Continue reading Inflating different xml layouts in an Android ListView for different Objects.

Hiding a list item from an Android ListView without removing it from the data source.

Ideally when I have to remove a list item from a listview, I’d remove the data object from the collection which the adapter uses and then do a adapter.notifyDataSetChanged() call which’ll redraw the list view. Consider an adapter which uses an array list of Strings. Now, to delete an item from the ListView, But this… Continue reading Hiding a list item from an Android ListView without removing it from the data source.

Generating compatible SHA512 Hash between Java and JavaScript using CryptoJS

While working on the development of a secure way for authenticating a remote web application with the Ambient Dynamix Framework, I needed to generate a SHA512 of a salt and token which the web application could transmit to the framework via a dynamically generated QR Code. The Dynamix instance running on the android device can… Continue reading Generating compatible SHA512 Hash between Java and JavaScript using CryptoJS

Detecting up-down, left-right swipe on Android.

This probably is the simplest way to detect the exact swipe direction on Android. We split the screen into four quadrants and then use the MotionEvents to calculate the angle of swipe. The code is pretty self explanatory. To check out how to use this SwipeGestureDetector class with the relevant view, check out this post… Continue reading Detecting up-down, left-right swipe on Android.

Privly reading app integration and detecting swipe gesture.

Reading App The Privly JS reading app helps a user to view the encrypted content behind privly links. We’ve been working to make sure that the same js app can be used on all platforms and have successfully integrated it on android apart from the web application and the firefox and chrome extensions. This makes… Continue reading Privly reading app integration and detecting swipe gesture.