In 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
What is a general rule of thumb concerning new classes? What constitutes creating and not creating a new class.
You should turn everything possible into an object and those objects should model the real world. I cover that in detail in my object oriented design tutorial.
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
File –> settings –> HTTP Proxy [Under IDE Settings] –> Auto-detect proxy settings
you can also use the test connection button
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.
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.
Make a good android jni tutorial!
I’ll be getting back into Android very soon. Thank you for the request
great job!!! is it the last part of the tutorial? if not , what come next?
Thank you 🙂 No I will continue the Android tutorial next week. I wanted to cover web services because I’ll be using them in the next Android tutorial
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 ?
The support library is backwards compatible. I was just showing the different options.
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.
I’ll be making many videos on testing very soon. Sorry about the wait.
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.
Hello, I covered that in part 3 of this series. You have to make a custom adapter. I hope that helps