/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.signup);

    setTitle(R.string.signUp);
    // Re-task if the request was cancelled.
    mSignupTask = (SignupTask) getLastNonConfigurationInstance();
    if (mSignupTask != null && mSignupTask.isCancelled()) {
      AppLog.d(CLASSTAG, "SignupTask previously cancelled, trying again.");
      mSignupTask = new SignupTask().execute();
    }

    setupUi();
  }
    @Override
    protected Boolean doInBackground(Void... params) {

      SmartTrailApplication app = (SmartTrailApplication) getApplication();

      try {

        mEmail = mEmailEditText.getText().toString().toLowerCase();
        mPassword = mPasswordEditText.getText().toString();
        String nickname = mNicknameEditText.getText().toString().toLowerCase();

        app.getApi().signup(nickname, mEmail, mPassword);

        app.signin(mEmail, mPassword);

        return true;

      } catch (Exception e) {
        AppLog.d(CLASSTAG, "Caught Exception signing up user.", e);
        mReason = e;

        return false;
      }
    }