Added check to prevent exception in interface builder

See docs on View.isInEditMode() for more information : http://developer.android.com/reference/android/view/View.html#isInEditMode()