open source is an ideology

###Extracts From a software about-me page MyAwesomeSauce is created by @me and open-sourced on Github Our library has been open-sourced and served under the GPL License v2 to facilitate ease of use among developers Seriously? Are you trying to market your creation or genuinely serving the interests of the open source community From Ben Balter: To say “hey, we’ve got something decent here, let’s take this closed-sourced project and just hit publish” misses the mark.

hide keyboard for multiple edit boxes in a page

How to hide Keyboard in the case of multiple Edit Text One common problem faced by people working on Android input field forms is that many a times there is a need to show/hide the keyboard when the person touches on some other part of the screen, other than the edit box itself. However, since the focus is retained by the edit box, even if the keyboard is hidden, its hard to actually detect when and where should you be hiding the keyboard.

install ia32 libs in saucy salamander ubuntu 13 dot 10

With the official release of Saucy Salamander 13.10 now available, I found myself installing it cleanly on my machine. However, when I went ahead to install the ia32-libs package for the Android 32-bit shared libraries supplied with the SDK. I had a shock. I could not install and the terminal returned this error message: output$ sudo apt-get install ia32-libs Reading package lists... Done Building dependency tree Reading state information... Done Package ia32-libs is not available, but is referred to by another package.

making a custom centre aligned radio button with a state list drawable

###Custom Widgets These days I have been working extensively on apps for the Android Platform. And one thing keeps coming back to me: Resuse of components and widgets. Although most of the time when you are doing simple apps, you don’t really pay much attention to the type of design and navigation strategies (SINGLE_TOP activities vs SINGLE_TASK blah.. blah) but when you are faced with putting different kinds of components in a single view then you probably have shuddered to think whether you were better off accomplishing this as a separate widget of its own. As can be seen from Romain Guy’s [Google IO Talk][googleio], developing custom views has its own significant advantages.

Some of the advantages are as follows:

  • A piece of highly reusable component will be at your disposal
  • you will have fine-grained control over the lifecycle of the control/widget that you are developing, (For example, you can decide whether to load images from the network or display a dummy error image in a custom ImageView see volley [NetworkImageView][netio] for details)
  • Custom views prevent cluttering of code in a single view thereby making abstraction more powerful
  • Other general advantages due to code reuse

So let’s dive into how I managed to make a custom widget for one of the apps.

phonelib bug regarding cant find proto

Do you make use of PhoneNumberUtils in your android project? If so, have you ever encountered this exception before? java.lang.RuntimeException: cannot load/parse metadata: /com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY at If yes, chances are you are probably using [proguard][progaurd] to do the obfuscation of code. However, as this points out, proguard automatically also obfuscates the library files. However, the PhoneNumberUtils has a hardcoded path to the proto files. Therefore, one cannot rely on obfuscating the library’s code.

finding a perfect dev environment

Setting up a unobstrusive development environment has its advantages. If you are one of those people who probably spend about 14 hours a day sitting in front of a monitor doing what-not, from testing to deployment and development, then read on. Otherwise you can spend some time reading an IBM justification of how and why a solid dev environment pays off. This post is about setting up a solid development environment on Ubuntu Linux 12.04 and contains bits and pieces of information of how a lot of things can be automated.

android shortcuts and must have gists

###Making use of shared preferences for storing information public boolean getStoredLoginState() { prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); boolean state = prefs.getBoolean(B_LOGGED_IN_STATE, false); return state; } public void setLoggedInState(boolean isLoggedIn) { prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(B_LOGGED_IN_STATE, isLoggedIn); editor.commit(); } ###Making use of the redirection trick Let’s say you want to make sure the user is logged in before giving him access to a particular activity view. What you can do is to check the status of the login token through a shared preference and send back an intent with the intent that the current view was invoked with via an extra Intent parameter This is the code for the invoker: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detail_view); if (getStoredLoginState() == true) { Intent intent = this.getIntent(); Log.i(TAG, "DetailView onCreate recd position of item: " + intent.getIntExtra(ITEM_ID, 10)); int pos = intent.getIntExtra(ITEM_ID, 10); // Set the text TextView textView = (TextView) findViewById(; textView.setText(" " + pos); } else { // not logged in Intent intent = this.getIntent(); Intent newIntent = new Intent(this, LoginActivity.class); newIntent.putExtra(REDIRECT_INTENT, intent); // newIntent.setAction(Intent.ACTION_MAIN); newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(newIntent); } } And this is the login view code.

making sense of vacations geek style


Summer time and any geek knows that sitting at home means doing something to increase your productivity levels is a good thing. So here is something that I plan/have done.

my final year project a web app hosting for apps

For my final year project in the School of Computing NUS I had to do something very exciting related to working with web apps. If you are familiar with online continuous integration environments like [Travis][travis] and [Jenkins][jenkins] then cracking this issue is a hen’s egg. The thing that I was required to do was compile and run research programs within a webapp. That is, feed input to a program written in C, C++ etc. and get the output, display it to the user. All of this included a data repository which housed patient data.

android development within a virtual machine

Sometimes it can be [really fustrating][vmware-issue] to work within a Virtual Machine (VM) which might not have support for a number of removable devices. I am talking of VMWare workstation which is a big part of the problem.

Below I describe a working way to install a reliable working environment in VMWare Workstation 9.x running Ubuntu 12.10