Question Detail

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


Thread Reply

Anonymous

- 1 years ago

Try This 
Fragment fragment = new MainFragment();
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.fragment_frame, fragment, fragment.getClass().getSimpleName()).addToBackStack(null).commit();