// This is where the navpane items are defined
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Called when a nav option is clicked, determines what option was chosen, and reacts
    switch (item.getItemId()) {
      case R.id.sort_name:
        sortBy = TaskListManager.NAME;
        taskList = TaskListManager.sortTaskList(sortBy, taskList);
        Toast.makeText(MainActivity.this, "Sorted Alphabetically", Toast.LENGTH_SHORT).show();
        break;
      case R.id.sort_date:
        sortBy = TaskListManager.DATE;
        taskList = TaskListManager.sortTaskList(sortBy, taskList);
        Toast.makeText(MainActivity.this, "Sorted by Date", Toast.LENGTH_SHORT).show();
        break;
      case R.id.sort_priority:
        sortBy = TaskListManager.PRIORITY;
        taskList = TaskListManager.sortTaskList(sortBy, taskList);
        Toast.makeText(MainActivity.this, "Sorted by Priority", Toast.LENGTH_SHORT).show();
        break;
    }
    displayList();

    // Closes the navpane afterwards
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
 @Override
 protected void onResume() {
   super.onResume();
   taskList = TaskListManager.loadTaskList(this);
   taskList = TaskListManager.sortTaskList(sortBy, taskList);
   displayList();
 }