/** Updates the display */
 private void updateDisplay() {
   if (borrowedBooks != null) {
     adapter =
         new BookAdapter(getActivity(), R.layout.item_bookborrowrequest, borrowedBooks, this);
     list.setAdapter(adapter);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    list = new ListView(getActivity());
    list.setBackgroundColor(Color.WHITE);
    borrowedBooks = new ArrayList<>();

    // Initiate progressbar
    pb = new ProgressBar(getActivity()); // Init the progressbar
    pb.setId(1); // Give pb an id
    pb.setVisibility(View.INVISIBLE); // Set progressbar visibility

    // Progressbar details
    RelativeLayout.LayoutParams progressBarDetails =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    progressBarDetails.addRule(RelativeLayout.CENTER_HORIZONTAL);
    progressBarDetails.addRule(RelativeLayout.CENTER_VERTICAL);

    if (borrowedBooks.isEmpty()) {
      try {
        requestRequests(BookshelfConstants.CONNECTION_URI);
      } catch (JSONException e) {
        e.printStackTrace();
      }
    } else {
      updateDisplay();
    }
    return list;
  }