posted 4 years ago
Hi all,
I really hope anyone can help me. I'm busting my head for daaays.
I have a simple MainActivity, with activity_main.xml, which has a DrawerLayout (which shows nicely) and FrameLayout (which is intended for Fragment). Both DrawerLayout and FrameLayout are childrens of simple LinearLayout.
Now, once I start my simple app from phone/emulator, weird thing happen. First, activity appears (as expected) and then Fragment appears but with small delay. So I have to press back button two times in order to get out of the app, even tho I explicitly said to FragmentManager no to put Fragement on the back stack.
My main goal for this demo exercise is to show Fragement (which has couple of Cinema objects through RecyclerView) from within activity. Key idea is to use that FrameLayout (fragment_container) and through it to display fragment's view. (I don't know if this is possible or maybe this is the place where mistake is hidding) And I want Drawer to be present, but froM Activity. Like I said, I did succeed to display, through RecyclerView, those Cinema object (stored in some Singleton helper class). Now, I have to press two times Back to get out of the app, don't want that.
Here is code.
FragmentTransition class (I could have posted right there in MainActivity, but our TA told us to do it this way)
XML for MainActivity
Here is the Fragment from the beginning of the post, I called it CinemaListFragment
And finally code for simple RecyclerView for this Fragement (fragement_cinema_list):
I apologize for this long code post. If necessary, I could send zip of the project. It is not big, simple student exercise.
Lets go Ranchers