Question Detail

How to call Fragment From Activity in Android ?

6 years ago Views 1408 Visit Post Reply

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

Thread Reply


- 6 years ago

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