Question Detail

How to call Fragment From Activity in Android ?

4 years ago Views 909 Visit Post Reply

I am a beginner in Android and using first-time Fragment How to Call Fragment from Activity in Android ?

Thread Reply


- 4 years ago

Try This 
Fragment fragment = new MainFragment();
                    .replace(, fragment, fragment.getClass().getSimpleName()).addToBackStack(null).commit();