/** * Confirms account registration and then finishes RegisterAccount Activity and returns to Profile * Activity. * * @param v view * @throws Exception exception */ @SuppressLint("NewApi") public void onAddAccount(View v) throws Exception { System.out.println("LOOO"); System.out.println("String; " + accName.getText().toString()); if (!accName.getText().toString().isEmpty() && !bal.getText().toString().isEmpty()) { String accountName = accName.getText().toString(); String balance = bal.getText().toString(); double balanceD = Double.valueOf(balance); // checking to see correct input System.out.println("name: " + accountName); System.out.println("bal: " + balance); Account acc = new Account(balanceD, accountName); try { db.addAccount(currentProfile, acc); } catch (InvalidAccountException e) { Toast.makeText(getApplicationContext(), "Account already exists..", Toast.LENGTH_SHORT) .show(); } finish(); } else { System.out.println("lele"); Toast.makeText( getApplicationContext(), "Please enter valid Account Name and Balance.", Toast.LENGTH_SHORT) .show(); } }