@Override
  protected void onCreate(Bundle savedInstanceState) {

    Thread.setDefaultUncaughtExceptionHandler(
        new Thread.UncaughtExceptionHandler() {
          @Override
          public void uncaughtException(Thread thread, final Throwable ex) {

            LPluginBug bug = new LPluginBug();
            bug.error = ex;
            bug.errorTime = System.currentTimeMillis();
            bug.errorThread = thread;
            bug.errorPlugin = remotePlugin;
            bug.processId = android.os.Process.myPid();
            LPluginBugManager.callAllBugListener(bug);
          }
        });
    super.onCreate(savedInstanceState);
    final Bundle pluginMessage = getIntent().getExtras();

    String pluginActivityName;
    String pluginDexPath;
    if (pluginMessage != null) {
      pluginActivityName =
          pluginMessage.getString(
              LPluginConfig.KEY_PLUGIN_ACT_NAME, LPluginConfig.DEF_PLUGIN_CLASS_NAME);
      pluginDexPath =
          pluginMessage.getString(
              LPluginConfig.KEY_PLUGIN_DEX_PATH, LPluginConfig.DEF_PLUGIN_DEX_PATH);
    } else {
      throw new PluginCreateFailedException("Please put the Plugin Path!");
    }
    if (pluginDexPath == LPluginConfig.DEF_PLUGIN_DEX_PATH) {
      throw new PluginCreateFailedException("Please put the Plugin Path!");
    }

    remotePlugin = loadPlugin(LActivityProxy.this, pluginDexPath);

    if (pluginActivityName != LPluginConfig.DEF_PLUGIN_CLASS_NAME) {
      remotePlugin.setTopActivityName(pluginActivityName);
    }

    fillPlugin(remotePlugin);
    // remotePlugin.from().debug();

    PluginActivityControl control =
        new PluginActivityControl(
            LActivityProxy.this,
            remotePlugin.getCurrentPluginActivity(),
            remotePlugin.from().pluginApplication);
    remotePlugin.setControl(control);
    control.dispatchProxyToPlugin();
    try {
      control.callOnCreate(savedInstanceState);
      LCallbackManager.callAllOnCreate(savedInstanceState);
    } catch (Exception e) {
      processError(e);
    }
  }
 @Override
 protected void onResume() {
   super.onResume();
   if (remotePlugin == null) {
     return;
   }
   PluginActivityCallback caller = remotePlugin.getControl();
   if (caller != null) {
     caller.callOnResume();
     LCallbackManager.callAllOnResume();
   }
 }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (remotePlugin == null) {
      return super.onKeyDown(keyCode, event);
    }
    PluginActivityCallback caller = remotePlugin.getControl();
    if (caller != null) {

      LCallbackManager.callAllOnKeyDown(keyCode, event);
      return caller.callOnKeyDown(keyCode, event);
    }

    return super.onKeyDown(keyCode, event);
  }
  @Override
  protected void onRestart() {
    super.onRestart();
    if (remotePlugin == null) {
      return;
    }

    PluginActivityCallback caller = remotePlugin.getControl();
    if (caller != null) {
      try {
        caller.callOnRestart();
        LCallbackManager.callAllOnRestart();
      } catch (Exception e) {
        processError(e);
      }
    }
  }
  @Override
  public void onBackPressed() {

    if (remotePlugin == null) {
      super.onBackPressed();
    }

    PluginActivityCallback caller = remotePlugin.getControl();
    if (caller != null) {
      try {
        caller.callOnBackPressed();
        LCallbackManager.callAllOnBackPressed();
      } catch (Exception e) {
        processError(e);
      }
    }
  }