private void loginToApp() {
    EditText usernameField = (EditText) findViewById(R.id.username_field);
    EditText passwordField = (EditText) findViewById(R.id.password_field);
    EditText emailField = (EditText) findViewById(R.id.email_field);

    if (areFieldsEmpty(usernameField, passwordField, emailField)) {
      AlertDialogs.showEmptyFieldsAlertDialog(this);
      return;
    }
  }
  @Override
  public Dialog onCreateDialog(int id, final Bundle bundle) {
    switch (id) {
      case DIALOG_NEW_PROJECT_ID:
        {
          return AlertDialogs.createEditDialog(
              this,
              null, // No title
              null, // No text in the edit box
              getString(android.R.string.ok),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  final TextView tv = (TextView) ((AlertDialog) dialog).findViewById(R.id.text_1);
                  final String projectName = tv.getText().toString();
                  removeDialog(DIALOG_NEW_PROJECT_ID);
                  createProject(projectName);
                }
              },
              getString(android.R.string.cancel),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  removeDialog(DIALOG_NEW_PROJECT_ID);
                }
              },
              new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                  removeDialog(DIALOG_NEW_PROJECT_ID);
                }
              },
              InputType.TYPE_NULL,
              32,
              getString(R.string.projects_project_name));
        }

      case DIALOG_REMOVE_PROJECT_ID:
        {
          final String projectPath = bundle.getString(PARAM_DIALOG_PATH_ID);
          return AlertDialogs.createAlert(
              this,
              getString(R.string.editor_delete_project),
              0, // no icons for this dialog.
              getString(R.string.editor_delete_project_question),
              getString(R.string.yes),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  removeDialog(DIALOG_REMOVE_PROJECT_ID);
                  deleteProject(projectPath);
                }
              },
              getString(R.string.no),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  removeDialog(DIALOG_REMOVE_PROJECT_ID);
                }
              },
              new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                  removeDialog(DIALOG_REMOVE_PROJECT_ID);
                }
              },
              true);
        }

      default:
        {
          return null;
        }
    }
  }