How to Make Android Apps 13

Android Fragment ExampleIn this tutorial I’ll finish up the Android Fragment example I started in part 12. Watch part 12 first. Here is the entire package available for download.

This time will cover how to switch to either an Activity if we are in portrait mode, or how to change the hero data dynamically on the screen if we are in horizontal mode. This is a very useful technique to learn. All of the code follows the tutorial below.

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

Code from the Video

DetailsFragment.java

DetailsActivity.java

AndroidManifest.xml

17 thoughts on “How to Make Android Apps 13”

  1. What is a general rule of thumb concerning new classes? What constitutes creating and not creating a new class.

  2. This is my first day and is not showing preview.there are messages like
    Error:connection timed out:if you are behind an HTTP proxy,please configure the proxy settings either in IDE ot Gradle

  3. Hi Derek,
    Probably you have answered these questions in some comments but would you tell me when you will continue your android tutorial and should I learn PHP in order to develop android apps.

    1. I’ll upload a video on MySQL and then web services. Then I’ll get into how to use web services with Android. Then I’ll make a bunch of Android tutorials in a row. Sorry about the wait. I have been overwhelmed with work for the past month.

  4. Hi , a little question :
    why do you import android.app.Fragment in details fragment code and not android.support.v4.app.Fragment as we did last time?
    is there a difference between the two imports ? when do we use each one ?

  5. Hey Derek:

    Have you tried building any “androidTest” modules in Android Studio.

    I have to admit that right from the git-go I find the testing structure under A.S. very confusing. All of the testing documentation assumes that you are building a new package just at the /src level, but it seems that A.S. is only building a new .apk at the /app level.

    Also A.S. doesn’t automatically build new AndroidManifest.xml or gradle or other template structures, and I’m wandering if I’m interpreting correctly that I must manually build them, or if there are ‘as yet’ undiscovered switches in the build files that I should use to construct my test files from a different target in the same build files.

    Just writing this has given me some ideas, but any insights you might have would be great.

  6. Hello Derek,

    Need Help!
    Can you please provide me with some hints how can I add icons and color to the listview you have created in the above code.

Leave a Reply

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