I'm trying to understand the flow of Android apps. I come from a RoR background, so I try and use that background to understand new concepts in Android. Here's my question:How can I think about fragments? Are they like partials in Rails? If so, how? If not, why?
Analogy for Android fragments
android
Not Sure how android fragments could be compared to RoR but I can tell you about what I know.You should think of Fragments as SubActivities, just like an Activity a fragment has also a life cycle:The whole point in fragments is to be able to run multiple section of an activity independently.It's like breaking down an activity and being able to update each one on its own.You have to keep in mind fragments run on activities.To understand more you should look into sample projects like the navigation Drawer one from google where a sliding menu is implemented in an activity, the activity (menu) then is responsible for swaping the different Fragments (Menu items).Sample code