@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_present, container, false); txtviewIntro = (TextView) view.findViewById(R.id.txtview_goals_intro); txtviewIntro.setTextColor(Color.GRAY); fab = (FloatingActionButton) view.findViewById(R.id.btn_action_button); fab.setOnClickListener(this); goalsMap = new HashMap<String, Integer>(); MySQLiteHelper db = new MySQLiteHelper(activity); List<Goal> goals = db.getAllGoals(); db.close(); displayGoals(display_present); goalsListView = (ListView) view.findViewById(R.id.listview_goals); goalsListView.setAdapter(goalAdapter); goalsListView.setOnItemClickListener(this); for (Goal goal : goals) { goalsMap.put(goal.getTitle(), goal.getId()); } fab.attachToListView(goalsListView); return view; }