package com.lenguyenthanh.nimble.view;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;

public class ViewHelper {
  private ViewHelper() {
  }

  private static ViewHelper instance;

  public static ViewHelper getInstance() {
    return instance;
  }

  public Activity getActivity(Context context) {
    while (!(context instanceof Activity) && context instanceof ContextWrapper) {
      context = ((ContextWrapper) context).getBaseContext();
    }
    if (!(context instanceof Activity)) {
      throw new IllegalStateException(
          "Expected an activity context, got " + context.getClass().getSimpleName());
    }
    return (Activity) context;
  }
}

@@ -268,24 +268,91 @@
 nstance() %7B%0A
+    if(instance == null)%7B%0A      instance = new ViewHelper();%0A    %7D%0A
     return i

Fix NPE in ViewHelper class