@Override protected void onCreate(Bundle savedInstanceState) { this.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sharedPrefs = new SharedPrefs(this); SharedPrefs.initializeInstance(this); Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this)); databaseHandler = new DatabaseHandler(getBaseContext()); credentials = new Credential(getApplicationContext(), this); editTextUsername = (EditText) findViewById(R.id.editTextUsername); editTextPassword = (EditText) findViewById(R.id.editTextPassword); submitButton = (RobotoButtonBold) findViewById(R.id.submit_button); toggleBtn = (ImageView) findViewById(R.id.rememberSwitch); editTextUsername.setGravity(Gravity.CENTER); editTextPassword.setGravity(Gravity.CENTER); editTextPassword.setOnEditorActionListener( new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { logIn(); return true; } return false; } }); editTextUsername.setOnEditorActionListener( new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { logIn(); return true; } return false; } }); // set ddatabaseHandler size // getDBSize(); if (!credentials.getUsername().isEmpty()) { Log.i( "MainActivity", "U: " + credentials.getUsername() + "/ P: " + credentials.getPassword()); editTextUsername.setText(credentials.getUsername()); editTextPassword.setText(credentials.getPassword()); } // if the app is configured if (sharedPrefs.getValueBol(SharedPrefs.KEY_CONFIGURED)) { } else { // getDBSize(); Intent intent = new Intent(this, WelcomeActivity.class); startActivity(intent); } }