package net.ilexiconn.hipster.fragment;

import net.ilexiconn.hipster.R;
import net.ilexiconn.hipster.fragment.main.DashboardFragment;
import net.ilexiconn.hipster.fragment.main.GradesFragment;
import net.ilexiconn.hipster.fragment.main.SettingsFragment;
import net.ilexiconn.hipster.fragment.main.TimetableFragment;

public enum Fragments {
    DASHBOARD(R.id.nav_dashboard, new DashboardFragment(), R.drawable.ic_class_black_24dp),
    GRADES(R.id.nav_grades, new GradesFragment(), R.drawable.ic_done_all_black_24dp),
    TIMETABLE(R.id.nav_timetable, new TimetableFragment(), R.drawable.ic_watch_later_black_24dp),
    SETTINGS(R.id.nav_settings, new SettingsFragment(), R.drawable.ic_settings_black_24dp);

    private int id;
    private IFragment fragment;
    private int icon;

    Fragments(int id, IFragment fragment, int icon) {
        this.id = id;
        this.fragment = fragment;
        this.icon = icon;
    }

    public int getId() {
        return id;
    }

    public IFragment getFragment() {
        return fragment;
    }

    public int getIcon() {
        return icon;
    }

    public static Fragments getFragmentFromID(int id) {
        for (Fragments fragments : values()) {
            if (fragments.id == id) {
                return fragments;
            }
        }
        return null;
    }
}

@@ -369,19 +369,16 @@
 hboard, 
-new
  Dashboa
@@ -379,34 +379,38 @@
 ashboardFragment
-()
+.class
 , R.drawable.ic_
@@ -455,20 +455,16 @@
 _grades,
- new
  GradesF
@@ -462,34 +462,38 @@
 , GradesFragment
-()
+.class
 , R.drawable.ic_
@@ -547,20 +547,16 @@
 metable,
- new
  Timetab
@@ -557,34 +557,38 @@
 imetableFragment
-()
+.class
 , R.drawable.ic_
@@ -647,12 +647,8 @@
 ngs,
- new
  Set
@@ -660,18 +660,22 @@
 Fragment
-()
+.class
 , R.draw
@@ -737,25 +737,21 @@
 private 
-IFragment
+Class
  fragmen
@@ -798,25 +798,21 @@
 int id, 
-IFragment
+Class
  fragmen
@@ -1015,24 +1015,133 @@
     
-return fragment;
+try %7B%0A            return (IFragment) fragment.newInstance();%0A        %7Dcatch (Exception e)%7B%0A            return null;%0A        %7D
 %0A   

Update Fragments.java