Monday, September 22, 2014

[Updated] Seagate External HDD NTFS Driver for Mac

This is a simplified post detailing how to go about using Seagate External HDD on Mac.

  1. The Seagate External HDD by default formatted as NTFS. Mac has flaky support to read and write to NTFS. Sometimes you will be able to write, otherwise it will open the HDD in read-only mode. In worst circumstances it will not even detect your HDD. Don't Panic.
  2. If you are able to read your Seagate HDD in read-only mode, check for driver inside Vendor folder and hope along with all the goodies you have the NTFS Driver. Don't confuse goodies with driver. After installing all the relevant apps inside Vendor, restart your Mac and hope everything works flawlessly. If you are still facing issues continue following the instructions.
  3. If the above solution didn't work for your or if you are not even able to detect your HDD, download the Paragon NTFS Driver for Mac from the Seagate website using this link. Accept the EULA, and download the dmg driver file. Install and restart your Mac, check you are able to detect your HDD and read/write without any issues.
These are the only tricks up my sleeve, if it still didn't work for you, hard luck :(. If this post was helpful, kindly '+1' this and leave a comment :).

Android Continuous Long Click Listener

This is about implementing a UI Pattern very common for mobile applications. You have a button which increments the value if you do a simple click on a button. If you long press instead of click, it increments the value in chunks rather than single units. These behaviours can be implemented using standard Android library event listeners like View.OnClickListener and View.OnLongClickListener.

For my app, I was looking for implementation where you keep the button pressed and it continuously keeps updating the value in chunks. Sadly, View.OnLongClickListener doesn't have any such support, so I decided to make a custom listener for this behaviour. You can view the final implementation here -

Some notes on the implementation of this listener -
  1. To support continuous long click listener, I am attaching 2 listeners to the view object. View.OnLongClickListener and View.OnTouchListener
  2. View.OnLongClickListener kicks in when it first detects a long click by user. After executing the default behaviour, it adds a delayed message to a Handler to execute the same code. This way, after a stipulated time the same code kicks in and increments the value again and thus simulating the required behaviour for continuous long click.
  3. View.OnTouchListener is used to detect a MotionEvent.ACTION_UP event, where the user disengages from the screen. On detecting it, any pending messages in the Handler are cleared thus finishing the event.
  4. As an add-on, I stimulate a haptic feedback every time the code is run to give user feedback about the long click action being kicked in.
The code for the above sample can be found on github here ->

The gist of listener implementation is below ->

Thursday, September 18, 2014

Enabling Developer Options in Xiaomi Redmi and Mi3 for Android Development and USB Debugging

I hope many of us in India were able to grab the Xiaomi Mi3 or Redmi throught the flash sale on Flipkart. If you haven't, I would highly recommend to get this value for money phone.

Anyways, for me, the primary purpose of buying this phone was to use it for Android App development. To my surprise, I couldn't find the USB Debugging option in the Settings. I was utterly confused and so I did the obvious - Googled it.

It turns out, the Developer Options are hidden by default in the MIUI - the custom UI that comes installed on Xiaomi phones. And to show these hidden options is like finding an easter egg.

To enable the developer options follow the steps as below -
  1. Open Settings -> General Settings -> About Phone (Screenshot 1)
  2. Tap on the item "Android version" (Screenshot 2). As you tap on it, you will see a toast message saying "x more clicks from Developer Options"
  3. As you keep tapping, finally you will see a toast message confirming "You are now a developer" (Screenshot 3)
  4. Thats it. To confirm the Developer options are enabled, go back to General Settings and find Developer options under System settings group (Screenshot 4)
This phone have host of Developer options ranging from the basic of keeping phone awake to doing some basic profiling. I haven't checked out all of them yet, but hope to do so soon. Happy coding.

Screenshot #1 Screenshot #2 Screenshot #3 Screenshot #4

Wednesday, August 27, 2014

Android Instructions Overlay - Showing a Screen Pointing To Hidden Navigation Features on First Launch

The demo code for this can be found @anagri/AndroidInstructionsOverlay.

With the advent of mobile apps, the standard patterns of UX are rapidly evolving. Each major release of Android or iOS brings with it some new and innovative UI features that is now the preferred way of interaction discarding the old one. Earlier, there were hardware buttons which are now replaced with onscreen buttons, menus are now replaced by the rich features of ActionBar and gestures open up a plethora of novel UX patterns everyday.

With so many UX patterns, it is very hard to convey to users on the first launch of app of the patterns you have used in your app. For some cases this problem can be solved by the Instructions Overlay screen. In this blog post I will take you through implementing one such simple application that uses this help pattern.

The Instructions Overlay is achieved by having an image that points to the main navigation features of the app, including gestures and setting this image to invisible by default. When the app is launched for first time, this image is displayed with a translucent background pointing to the actual widgets on the screen along with a concise instruction of using that widget. Also this is noted down in the preference/local datastore, so that this screen does not appear next time the app is launched. We also need to set a click listener so that if image is clicked or touched, it goes away. Optionally we can have a menu item which makes this instruction overlay image visible again for reference.

But with the screen size fragmentation, it is difficult to have a single image that displays the instructions. To overcome this issue, draw9patch tool is used to mark the areas that can be expanded if this image is being displayed on higher screen sizes. Just make sure the original image follows the aspect ratio of 4:3 which is the most common screen aspect ratio for Android devices.

This is how the instructions overlay looks on emulators running Galaxy Nexus S with screen resolution of 720x1280 and Nexus One with screen resolution 480x800.

Galaxy Nexus 720x1280 px Nexus One 480x800 px

Tuesday, August 26, 2014

Looping ViewPager - Small hack to make ViewPager loop through screens

For my Android app, I am using ViewPager to get a cool animation navigating by swiping cards left and right. The supporting Android class FragmentStatePagerAdapter does all the heavy lifting but also restricts few features.

For example, I was looking for a looping ViewPager, where on first swiping back from first page takes you to last page, as well on swiping forward on last page takes you back again to the first page and this loop continues.

I checked on stackoverflow for any clean solutions, but I was not satisfied with the hacks detailed over there. I did some brainstorming and started working on my own design.

So, I decided instead of having "n" pages in my ViewPager, I will have "n+2", that is additional 2 pages. I have 2 variables here, position - a zero index based variable specifying page number in ViewPager and contentIndex - an index of string array I am displaying as ViewPager cards. These additional 2 pages would be the first page at position 0 which would display the content at the last index of array, and the last page at position n+1 which would display the content at index 0. Thus for content at index 0 and n are being displayed by 2 pages.

Then I listen for OnPageChange events. For these 2 special pages, as soon as I land on them, instead of displaying these pages, I switch the page to go to the original page that was already displaying it at its proper position. I navigate to it without any animation.

For e.g. if I come to position 0 which displays the last content of array, instead of being at position 0, I switch it to position n which was displaying the same content. The switch is instantaneous, although if you watch closely, you will notice a sort of jerk that happens. Similarly I switch to page at position 1 as soon as I land on page at position n+1.

A project with complete implementation of above hack can be found on Github @anagri/ViewPagerLoop

The screenshots from the above app looks like -

The core logic in code is ->

If you found this helpful or have any suggestions, kindly leave a comment.

Monday, August 25, 2014

Learning Android Using Online Tutorials and Resources - A Comparison

I consulted the following resources to learn Android -
  1. Udemy Learn By Doing Android
  2. Lynda: Android SDK Local Data Storage
  3. Lynda: Connecting Android Apps to RESTful Webservices
  4. Vogella Android Text Tutorials
  5. Google Android Developer Training
  6. SlideNerd: Fragments in Android
I came up with a quick coverage matrix of each of the courses and how they fare covering various topics -

AreasUdemyLynda DataLynda RESTfulVogellaGoogle AndroidSlideNerd

The above table can be interpreted using -
Y = Sufficiently covered
Y = Sparsely covered
N = Expected but not present
- = Not Applicable

I will follow up with details of each of the tutorial, strength, weakness and suitability. Kindly leave your comments on how I can enhance the above matrix, including additional areas and trying out other tutorials.

Saturday, August 9, 2014

Eclipse Requiring JDK 6 Post OSX Maverick Update

I upgraded to Maverick OSX a few days back. Then when I started my ADT Eclipse back, surprisingly it threw a modal window asking for JDK 6 and asking to install if it didn't exist.

I checked through commandline that I had JDK 7 and on the path, so it was puzzling why Eclipse is behaving strangely. I was in no mood to install another JDK, that too one with out of End of Life support. So a quick googling I came across an easier solution that I am sharing here for everyone's benefit.
  1. Open folder /Library/Java/JavaVirtualMachines/jdk.1.7.x/Contents/
  2. Open Info.plist
  3. Replace line 
    With this
  4. Log out or Restart your machine
Hopefully this should help and work for you. 

Friday, February 14, 2014

Seagate External HDD NTFS Driver for Mac

Updated simplified post here.
There is very limited support for Reading and Writing to NTFS file format on Mac. Since most of the External Hard Drives (Seagate 1TB External HDD in my case) come with default format of NTFS, it is a pain to reformat it to universally compatible (Ex-Fat) format and sometimes you reluctantly avoid it.

Strangely, when I plugged in my Seagate drive to Mac, it was able to detect it and read and write effortlessly. But after a few days, it showed it could only read the drive and not write to it. It was very strange and I started to look for options since I was planning to use this drive as Backup and was intending to write heavily to it.

Mac OS X has limited support for writing to NTFS file format, but because of limited support this feature is hidden. I found a script which used this feature to enable you to write to your disk, but this had its own limitation.

Using this script I was able to write to my drive but soon I found it corrupted my files and made them inaccessible. Frustrated I resolved to Google search a solution again till I stumbled across Seagate site. They have a NTFS support for Mac through Paragon driver which typically you have to pay for but is FREE for Seagate customers. Installation was seamless and after I restart, I was able to use my drive smoothly without any further glitches. Hopefully this post should help people going through similar experience.

PS - (From Appy's comment below) Check if your HDD came with preloaded NTFS for Mac driver

Ordeal of renewing custom domain name on Blogger + Google + Godaddy

I received an email from Google stating that I don't have auto-renew option enabled on my domain and hence I stand a chance to loose this domain. I frantically tried to enable the auto-renew option and guess what ? it is not very straightforward and friendly.

Google used Godaddy as underlying domain registrar and creates an admin account bloggeradmin@ to manage domain registration along with other site issues. At time of custom domain registration for blog, it was just a few clicks and I never bothered to sign in to this account. Now when my domain is about to expire I am trying to desperately access it and avoid loosing years of my effort.

If you go through Google Help & Support documentation, you are just going to go through circles since there is no easy way to reset the password. One of the Google instruction in my case was to change the CNAME setting allowing a sub domain to forward to Since I don't have access to any DNS settings, how do they expect me to proceed ?

I am not a big-enterpricy customer for Google, and hence don't qualify for any of their in-person support. All I am left with is going through documentation and web searches. I almost thought I would loose my domain and started to put in request for Domain Nab service that would cost as high as $50 instead of the usual $10 for renewal.

Later on I stumbled across the Google Product Forum here. As I hoped, I was not the only one was so disappointed with Google support and trying to resolve the mess. As it happens, you can reset the admin account password for your account through this wonderful yet very secret link ( I was able to reset the bloggeradmin@ account which sent out password reset email to my primary email address and access the option of renewing my domain before it expires.

After going through this horrible experience with Google Domains, I decided to opt out of its service. The integration with Godaddy is horrible and I would rather manage my domain registrations through other providers, my preferred one is The domain transfer request is underway and hopefully there should be no hiccups in the future. Hope this information helps other bloggers who are going through similar ordeal.