@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.login_two_factor_auth);

    accountManager = AccountManager.get(this);

    ViewFinder finder = new ViewFinder(this);
    otpCodeText = finder.find(R.id.et_otp_code);

    final Intent intent = getIntent();
    username = intent.getStringExtra(PARAM_USERNAME);
    password = intent.getStringExtra(PARAM_PASSWORD);

    TextView signupText = finder.find(R.id.tv_signup);
    signupText.setMovementMethod(LinkMovementMethod.getInstance());
    signupText.setText(Html.fromHtml(getString(R.string.signup_link_two_factor_auth)));

    TextWatcher watcher =
        new TextWatcherAdapter() {

          @Override
          public void afterTextChanged(Editable gitDirEditText) {
            updateEnablement();
          }
        };
    otpCodeText.addTextChangedListener(watcher);

    otpCodeText.setOnKeyListener(
        new View.OnKeyListener() {

          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event != null
                && ACTION_DOWN == event.getAction()
                && keyCode == KEYCODE_ENTER
                && loginEnabled()) {
              handleLogin();
              return true;
            } else return false;
          }
        });

    otpCodeText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == IME_ACTION_DONE && loginEnabled()) {
              handleLogin();
              return true;
            }
            return false;
          }
        });
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(getContentViewResId());
   // update title
   getSupportActionBar().setTitle(getTitleResId());
   // bind to service
   serviceManager = new SpiceManager(JsXmlSpiceService.class);
   // get resource info
   executeResourceRequest(true);
 }
 @Override
 protected void onResume() {
   super.onResume();
   updateEnablement();
 }
 @Override
 protected void onStop() {
   serviceManager.shouldStop();
   super.onStop();
 }
 @Override
 protected void onStart() {
   serviceManager.start(this);
   super.onStart();
 }