app/src/main/java/com/zenappse/memorymatcher/LoginMainActivity.java
public void attemptLogin() {
        // Reset errors.
        mUsernameTextView.setError(null);

        // Store values at the time of the login attempt.
        String username = mUsernameTextView.getText().toString();

        boolean cancel = false;
        View focusView = null;

        // Check for a valid email address.
        if (TextUtils.isEmpty(username)) {
            mUsernameTextView.setError(getString(R.string.error_field_required));
            focusView = mUsernameTextView;
            cancel = true;
        }

        if (cancel) {
            // There was an error; don't attempt login and focus the first
            // form field with an error.
            focusView.requestFocus();
        } else {

            if (!authenticateUsername(username)) {
                // "Register" a new user since username was not found
                gameStorageManager.registerUsername(username);
            }

            gameStorageManager.setLastUsedUsername(username);

            Intent tabbedGameIntent = new Intent(this, TabbedGameActivity.class);
            tabbedGameIntent.putExtra(EXTRA_USERNAME, username);
            startActivityForResult(tabbedGameIntent, TABBED_GAME_REQUEST);
        }
    }
/**
     * Auto-generated by Android Studio
     * Modified to suit this specific apps needs
     *
     * If textView is empty, then display error. Else, register username if
     * it doesn't exist, then proceed to the next activity.
     */


If textView is empty, then display error. Else, register username if
it doesn't exist, then proceed to the next activity.
If textView is empty then display error . Else register username if it doesn ' t exist then proceed to the next activity .
public void attemptLogin() {
        mUsernameTextView.setError(null);
        String username = mUsernameTextView.getText().toString();
        boolean cancel = false;
        View focusView = null;
        if (TextUtils.isEmpty(username)) {
            mUsernameTextView.setError(getString(R.string.error_field_required));
            focusView = mUsernameTextView;
            cancel = true;
        }
        if (cancel) {
            focusView.requestFocus();
        } else {
            if (!authenticateUsername(username)) {
                gameStorageManager.registerUsername(username);
            }
            gameStorageManager.setLastUsedUsername(username);
            Intent tabbedGameIntent = new Intent(this, TabbedGameActivity.class);
            tabbedGameIntent.putExtra(EXTRA_USERNAME, username);
            startActivityForResult(tabbedGameIntent, TABBED_GAME_REQUEST);
        }
    }
public void attemptLogin ( ) { mUsernameTextView . setError ( null ) ; String username = mUsernameTextView . getText ( ) . toString ( ) ; boolean cancel = false ; View focusView = null ; if ( TextUtils . isEmpty ( username ) ) { mUsernameTextView . setError ( getString ( R . string . error_field_required ) ) ; focusView = mUsernameTextView ; cancel = true ; } if ( cancel ) { focusView . requestFocus ( ) ; } else { if ( ! authenticateUsername ( username ) ) { gameStorageManager . registerUsername ( username ) ; } gameStorageManager . setLastUsedUsername ( username ) ; Intent tabbedGameIntent = new Intent ( this , TabbedGameActivity . class ) ; tabbedGameIntent . putExtra ( EXTRA_USERNAME , username ) ; startActivityForResult ( tabbedGameIntent , TABBED_GAME_REQUEST ) ; } }
Auto-generated by Android Studio
 Modified to suit this specific apps needs
Auto - generated by Android Studio Modified to suit this specific apps needs
// Reset errors. // Store values at the time of the login attempt. // Check for a valid email address. // There was an error; don't attempt login and focus the first // form field with an error. // "Register" a new user since username was not found