Home screen for android app

-1

I created an APP with a drawer menu, the drawable menu that appears as a template when creating a project in Android Studio. I was able to create the fragments and relate to the menu, it is working beauty, my problem is that I can not define my "home" as initial, for example, when I opened the application I wanted to load that fragment fragment .

    
asked by anonymous 08.09.2017 / 21:11

1 answer

2

To set an initial fragment , just use FragmentTransaction on your onCreate() . Here is an example:

ExemploFragment fragment = new ExemploFragment();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_exemplo, fragment);
fragmentTransaction.commit();
    
08.09.2017 / 21:20