The Tutorial
Of course, feel free to leave a comment. I’m always happy to read about what you think.
You can download the project files for this episode here: Episode #8 Project Files (.zip)
- Episode #9 – Lists: Item Clicks
- Episode #11 – Intents: Multi Activity Applications
- Episode #6 – Notification & Long Clicks
- Episode #10 – Intents: An Introduction
- Episode #2 – Create A New Project And Run It
- Episode #3 – Using Buttons
- Episode #7 – Using Basic Lists
- Episode #1 – Getting Started!
- Episode #4 – Checkboxes & Complex Layouts
- Episode #5 – Using Radio Buttons

Comments
Bruno
11/10/2009 – 1:50 pmHei Mathias, congrats for your tutorias! Their really helpful.
Let me ask you something, why sometimes do you use ‘this’ to refer to the context and sometimes you use ‘getApplicationContext()’ ? What’s the difference?
Mathias Reisch
11/10/2009 – 9:01 pmHey Bruno,
in the Toast.makeText() method you have to use ‘getApplicationContext()‘ because ‘this‘ would refer to the anonymous inner class that is DialogInterface.onClickListener(). Alternatively you could use ‘.this‘, e.g. ‘Episode8.this‘. Using ‘getApplicationContext()‘ in the AlertDialog.Builder() constructor will result in a runtime error because you have to refer to the activity context using ‘this‘ rather than the global application context.
Hope this helps!
ernie
01/12/2010 – 3:54 amThis is one of the best tutorial videos on Android. Great work. Hope the author is working on more !!!
John
03/31/2010 – 8:14 pmVery Usefull. Thanks a lot.
Siddharth
05/02/2010 – 8:01 pmDoesn’t SDK 2.1 support AlertDialog?
I keep getting an error (Underlined error) when i try to use it in global variables.
Cheers….
Mathias Reisch
05/02/2010 – 8:10 pmHi Siddharth,
there shouldn’t be any problem with Android 2.1 and the AlertDialog. Have you actually imported the class into your project via import android.app.AlertDialog;?
Siddharth
05/03/2010 – 6:57 amHey Mathias,
Yes sir. I tried to import the android.app.AlertDialog.
However, it still doesnt seem to like it.
I will however try the entire tutorial in 1.6 to see if its a problem with the 2.1 or the system as a whole.
FYI: I am using Motodev Studio.
Will post as soon as its done.
Cheers….
Innovate
05/05/2010 – 12:09 amHow to add DinlogInterface to the buttons of the customised Alert Dialog Box
Hicham
06/04/2010 – 9:42 pmHi Mathias,
First let me tell I am really enjoying your tutorials and I am looking forward to complete them..
I have noticed that when you change the the screen layout from landscape to portrait mode (The opposite way is true too) the App loses its state? why is that and what is the resolution?
Thank you
Mathias Reisch
06/04/2010 – 10:31 pmHey Hicham,
I’m happy to hear that you like the tutorials. Regarding your question: Whenever you rotate your phone you change your current device configuration and thus the currently running activity calls its onDestroy() method and then recreates itself by calling its onCreate() method again. However, you can store your application state before the activity gets destroyed and restore it when it gets recreated.
The official Android SDK Development Guide actually features a very nice article about that topic. Check it out for yourself: Runtime Changes
Also, you might want to take a look at the activity lifecycle, i.e. which methods get called during the lifespan of an activity. You can find that here: Activity Lifecycle
I’m pretty confident that those articles will answer all your questions.
Razouille
08/27/2010 – 2:28 pmA comment which does not concern the great tutorial (as the others) but the pub at the beging of the video.
I clicked on it and got an error:
Error 500 Error: Not a valid request — invalid checksum
The link is:
http://ad.doubleclick.net/clk;227964789;41829424;e
Clicking on the ads is the least we can do to thank you for this tutorials so i hope you’ll fix it. Keep on the great job!
Razouille
08/27/2010 – 2:51 pmI agree with siddharth thiere is a problem when you try to import android.app.AlertDialog as an AlertDialog seems to be in conflic with a type defined in the same file.
So what I did to make it work I used the full package name for declarign the vaiables builder and alert:
android.app.AlertDialog.Builder builder;
android.app.AlertDialog alert;
Razouille
08/27/2010 – 3:02 pmStupid me :)
Forgive my previous message it was because I called my Activity AlertDialog :)