How to Make Android Apps 11

Android Multipane Fragment ExampleIn this video I present the Android multipane Fragment example code many of you have requested. I did my best to create a template you can use in numerous apps. I also did my best to keep the code very short.

We’ll cover creating layouts that contain multiple fragments. We’ll switch between layouts based on screen orientation. We’ll also cover how to use the support libraries and Gradle so that we can use Fragments in older versions of Android.

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

Here is the whole package for this app.

Code From the Video

fragment_main_panel.xml

fragment_side_panel.xml

SidePanelFragment.java

MainPanelFragment.java

activity_my.xml

/layout-land/activity_my.xml

build.gradle

MyActivity.java

19 thoughts on “How to Make Android Apps 11”

      1. i can’t download the package, when i click the link it says “Sorry, the page your requested could not be found, or no longer exists.”

          1. Hello Derek, great tutos.

            I still am having problems downloading the code in ZIP that you setup.

            What about uploading that into github so we can just clone the repo?

            BTW: Great videos, man!

            1. Thank you ๐Ÿ™‚ I just tested the download and it worked. I’ll try to uplad to github, but the code is also available under the link in the mean time. Sorry about the issues your having.

    1. @Altiano maybe it is too late, but for another reader :
      In the Video MyActivity extends from Activity.
      Change Activity to FragmentActivity. That is the problem.

      Hope it helps.
      Happy Coding

  1. I am using an emulator to check my apps.
    1.
    In the tutorial-10(how to make and. apps) , I’m using ctrl+f11 to change the orientation of my emulator(portrait to landscape) but the text is not changing with the action.
    2.
    Also in the logcat I’m constantly getting the message : Skipped …. frames! The application may be doing too much work on its main thread.
    How to take care of this.

    1. Also , can you please explain the life cycle in android.
      In this tutorial , whenever I’m changing the configuration , side panel is getting hidden and visible according to the config., is this because onCreate is being called everytime we change config.

  2. Derek:

    Unless I comment out the exclude method of your code:

    31 configurations {
    32 all*.exclude group: ‘com.android.support’, module: ‘support-v4’
    33 }

    gradle refuses to sync. But once I do, the project build returns with errors:

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;

    I’m completely unfamiliar with this build tool, any ideas?

  3. Hi , I didnt understand why we neeed /layout-land/activity_my.xml , I didnt see reference to this layout in MyActivity.java.
    How does android know to use this layout in landscape mode?

  4. Hello Derek,

    I got problem that my fragments overlapping. I have been looking for answer on stackoverflow etc and couldn’t find anything ๐Ÿ™ do you know why that might be?

    Thanks,
    Matt

Leave a Reply

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