Can't make transaction in class <p>I have Main activity:</p> <pre><code>public class GeneralActivity extends ActionBarActivity { ... } </code></pre> <p>I have another class in which I create a drawer, I bring to the required parameters. But when I want to move to a different fragment when you click on the menu item, then IDE writes that there is no method getSupportFragmentManager ().</p> <pre><code>public class DrawerClass { public static void drawer(final Activity activity, Toolbar toolbar) { ... result.setOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int i, IDrawerItem iDrawerItem) { Log.d("POSITION", "position = " + i); switch (i) { .... case 5: Toast.makeText(activity, R.string.drawer_item_journal, Toast.LENGTH_SHORT).show(); JournalFragment journalFragment = new JournalFragment(); FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.replace(R.id.profile_fragment_layout, journalFragment); transaction.commit(); break; } return false; } }); </code></pre> <p>I have an error on the line <code>FragmentTransaction transaction = getSupportFragmentManager()</code> And I don't know how fix it. <br> I use this drawer in several classes, so I created a separate class in order to avoid duplication of code</p>