@Override
  public void onResume(final Activity context) {

    if (!Socialize.getSocialize().isInitialized(context)) {
      Socialize.getSocialize()
          .initAsync(
              context,
              new SocializeInitListener() {
                @Override
                public void onError(SocializeException error) {
                  SocializeLogger.e("Error occurred on resume", error);
                }

                @Override
                public void onInit(Context ctx, IOCContainer container) {
                  // This is the current context
                  setContext(ctx);

                  if (FacebookUtils.isAvailable(ctx)) {
                    try {
                      FacebookUtils.extendAccessToken(context, null);
                    } catch (Exception e) {
                      SocializeLogger.e("Error occurred on resume", e);
                    }
                  }
                }
              });
    } else {
      if (paused && FacebookUtils.isAvailable(context)) {
        try {
          FacebookUtils.extendAccessToken(context, null);
        } catch (Exception e) {
          SocializeLogger.e("Error occurred on resume", e);
        }
        paused = false;
      }

      // This is the current context
      setContext(context);
    }
  }
  public synchronized IOCContainer initWithContainer(
      Context context, SocializeInitListener listener, String... paths) throws Exception {
    boolean init = false;

    // Check socialize is supported on this device.
    isSocializeSupported(context);

    String[] localPaths = getInitPaths();

    if (paths != null) {

      if (isInitialized()) {

        if (localPaths != null) {
          for (String path : paths) {
            if (binarySearch(localPaths, path) < 0) {

              if (logger != null && logger.isInfoEnabled()) {
                logger.info("New path found for beans [" + path + "].  Re-initializing Socialize");
              }

              this.initCount = 0;

              // Destroy the container so we recreate bean references
              if (container != null) {
                if (logger != null && logger.isDebugEnabled()) {
                  logger.debug("Destroying IOC container");
                }
                container.destroy();
              }

              init = true;

              break;
            }
          }
        } else {
          String msg =
              "Socialize reported as initialize, but no initPaths were found.  This should not happen!";
          if (logger != null) {
            logger.error(msg);
          } else {
            System.err.println(msg);
          }

          destroy();
          init = true;
        }
      } else {
        init = true;
      }

      if (init) {
        try {
          Logger.LOG_KEY = Socialize.LOG_KEY;
          Logger.logLevel = Log.WARN;

          this.initPaths = paths;

          sort(this.initPaths);

          if (container == null) {
            container = newSocializeIOC();
          }

          ResourceLocator locator = newResourceLocator();

          locator.setLogger(newLogger());

          ClassLoaderProvider provider = newClassLoaderProvider();

          locator.setClassLoaderProvider(provider);

          if (logger != null) {

            if (logger.isDebugEnabled()) {
              for (String path : paths) {
                logger.debug("Initializing Socialize with path [" + path + "]");
              }

              Logger.logLevel = Log.DEBUG;
            } else if (logger.isInfoEnabled()) {
              Logger.logLevel = Log.INFO;
            }
          }

          ((SocializeIOC) container).init(context, locator, paths);

          init(context, container, listener); // initCount incremented here
        } catch (Exception e) {
          throw e;
        }
      } else {
        this.initCount++;
      }

      // Always set the context on the container
      setContext(context);
    } else {
      String msg = "Attempt to initialize Socialize with null bean config paths";
      if (logger != null) {
        logger.error(msg);
      } else {
        System.err.println(msg);
      }
    }

    return container;
  }