/**
  * 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();
   }
 }
  public DefaultListModel allTeacher() {
    List<String> allTeachers = new ArrayList<String>();
    allTeachers = db.getAllTeacher();
    // String[] test = new
    DefaultListModel lm = new DefaultListModel();
    for (int i = 0; i < allTeachers.size(); i++) {
      lm.add(i, allTeachers.get(i));
    }

    return lm;
  }
  // rewrite Data
  public Object[][] getPlan(ArrayList<Integer> teachers) {
    ArrayList<ArrayList<String>> planOld = new ArrayList<ArrayList<String>>();
    ArrayList<ArrayList<String>> plan = new ArrayList<ArrayList<String>>();
    ArrayList<String> test = db.getPlan(0, 3, 8);

    Object[][] planer = new Object[weekday][];

    // planer.

    plan.add(new ArrayList<>());

    for (int i = 0; i < teachers.size(); i++) {
      plan.get(i).add(String.valueOf(teachers.get(i) /*.toString()*/));
      // get plan from each teacher
      planOld.add(db.getPlan(teachers.get(i), weekday, maxHour));
    }

    // convert Plan
    for (int i = 1; i <= weekday; i++) {
      plan.add(new ArrayList<>());
      for (int j = 0; j < teachers.size(); j++) {
        plan.get(i).add(planOld.get(j).get(i - 1));
      }
      // planOld.add(db.getPlan(teachers.get(i), weekday, maxHour));
      // System.out.println(teachers.get(i));
      // db.getPlan(teachers.get(i), weekday, i)
    }

    // String[] test = (String[]) teachers.toArray();
    // Object[][] test = {teachers, {}};,

    for (int i = 0; i < weekday; i++) {
      planer[i] = plan.get(i).toArray();
      // test[i] = (String[]) plan.get(i).toArray();
      // test.add(i, plan.get(i).toArray());
    }

    return planer;
  }