Define a 'tag' for the Fragment while adding it like
getFragmentManager().beginTransaction().add(new Fragment(),"your_tag");
And while referencing it use
getFragmentManager().findFragmentByTag("your_tag");
In most cases, you would like to use YourFragment.class.getSimpleName()
as your tag.