I was using 'fragment' tag in the layout file for the Android app I was developing, as shown in the first code block. The id of the layout file for the CalendarFragment (.java) is R.id.calendar. I want to get the CalendarFragment instance in my code at runtime using getFragmentMeneger.findFragmentById(R.id.calendar) but kept getting null result. I ended up using getFragmentMeneger.findFragmentById(R.id.left1), the id for the 'fragment' tag in the main layout file to get the CalendarFragment at run time and it works. 'fragment' tag in the layout file for MainActivity.java: Actual layout file for the CalendarFragment.java: Actual java code in MainActivity.java to access the fragment: