How to Make Android Apps 10

Android Fragment TutorialIn this few parts of my Android tutorial I’ll focus on a Android Fragment Tutorial. I’ll start off slow here by showing you how to switch fragments based on screen orientation, which is very commonly used.

I’ll specifically cover the basics of fragments, layout fragments, FragmentManager, FragmentTransaction, committing fragment replacements, LayoutInflator, Configuration and more.

If you like videos like this, it helps to share on Google Plus with a click here [googleplusone]

Code From the Video

portrait_fragment.xml

landscape_fragment.xml

activity_my.xml

FragmentLandscape.java

FragmentPortrait.java

MyActivity.java

11 thoughts on “How to Make Android Apps 10”

  1. Hi derek ,thanks for the tutorial , its really detailed good and even fun 🙂 even for people who are not english native speaker like me.
    A little basic question, is the procedure onCreate on myActivity is executed each time I change the orientation of my device?

    I understand fragmentTransaction is responsible for replacing fragments. However,the condition to replace a fragment (=what is our orientation) is checked in onCreate procedure.
    thanks!

  2. Hi Derek!
    Thanks for tutorial. It really helped me a lot . But i am not sure about one thing. Can you please tell me what is activity_my.xml for?
    It is not used anywhere and i deleted it from my app and everything worked just perfect. Thank you for your answer.

    1. Hi Daniel, You’re very welcome 🙂 activity_my.xml is normally the default xml layout for the app. I kept it there for those people that used it because it is created by default.

  3. Hi Derek,
    The support folder is not in my sdk directory structure. Am I missing a package to install from the SDK manager?

Leave a Reply

Your email address will not be published. Required fields are marked *