code: public static boolean isTopApplication(Context context) {
  		ComponentName activity = getTopActivity(context);
  		if (activity == null) {
  			return false;
  		}
  		return activity.getPackageName().equals(context.getApplicationInfo().packageName);
  	}
docs: Determines if this application is top activity
  @param context Context to be examined
  @return true if this application is a top activity; false otherwise