Question Detail

How to call Fragment From Activity in Android ?

3 years ago Views 791 Visit Post Reply

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

Thread Reply


- 3 years ago

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