EESTEC Android Workshops - 101 Java, OOP and Introduction to Android


Published on

First of a workshop series by EESTEC LC Athens for Android. Introduction to Java, OOP and Android

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

EESTEC Android Workshops - 101 Java, OOP and Introduction to Android

  1. 1. EESTEC Android Workshops101 - Introduction to OOP, Java and Android
  2. 2. What we’ll cover today EESTEC, Android, it’s APP to you! Introduction to OOP Introduction to Java Setting up the Android Environment Running your first App
  3. 3. Android, it’s APP to you!
  4. 4. How do I apply?Create a great team!Find an outstandingidea!Complete a simpleform!
  5. 5. Let’s get to the point! OOP, here we come!
  6. 6. Basic ConceptsClass - Blueprint, used to create instances ofitselfObject / Instance - Instances are classoccurrencesMethod - Function / Procedure of an objector classAttribute - Fields with values (objects) in aobject
  7. 7. ProsCode decoupling, enforces code reusabilityAssociates data structures with their relatedmethodsMakes real-world object representationeasier
  8. 8. InheritanceClasses can extendother classes They inherit their attributes and methods Can extend only one class
  9. 9. name Human surname Walks, Sleeps sex no of toys job position Kid school grade Adult companyPlays, Cries no of friends Works vat no Example
  10. 10. Examplepublic class Hello { public static void main(String[] argv) { System.out.println(getHelloString()); } private static String getHelloString() { return "Hello"; }}public class HelloWorld extends Hello { @Override private static String getHelloString() { return "Hello, world!"; }}
  11. 11. InterfacesMake a class implement certain functionalityA class can implement more than oneinterfaces
  12. 12. Fema le Ad ult Example Kid ale Male Female M FeWatch football Cook male Snore Be grumpy for Hu no reason ma n
  13. 13. Examplepublic class Human { abstract void sayHi(); abstract void sayGoodBye();}public class Eestecer implements Human { @Override private static String sayHi() { System.out.println("Hello guys!"); } @Override private static String sayGoodBye() { System.out.println("Goodbye... Keep partying!"); }}
  14. 14. OOP LanguagesC++RubyPythonC#VB.NET...And, wait for it...
  15. 15. Java-dive!Let’s take a fast look
  16. 16. Java, at a glance C-like syntaxCreated in Sun Microsystems, by James Gosling Now acquired by Oracle
  17. 17. Hello, Java World!public class HelloJava { public static void main(String[] argv) { System.out.println(“Hello, Java World!”);}
  18. 18. Great Things about Java Has a garbage collector, simply do not care about memory leakage! Your program fails, except exceptions! Is platform-independent, runs in it’s own VM, the JVM
  19. 19. Garbage CollectorJava objects leave ina heapWhen the GarbageCollector needs torelease memory, itstarts removingdangling objectsSlightly pauses theapplication threads
  20. 20. ExceptionsJava gives you the chance to get a bit offtrack, but then makes sure you can handleunwanted situationsYou can try something weird and if it turnsbad, you handle the exception
  21. 21. Exampletry { something that might destroy the universecatch (EarlyDestructionExcpetion e) { save the world}
  22. 22. Say hello, to my Green friend
  23. 23. The mystery, explained... Complete software stack Operating System Middleware Key Applications Open Source Developed by the Open Handset Alliance Fastest growing market Platform with the most devices activations
  24. 24. Android, bottoms up!
  25. 25. Setup a new project
  26. 26. ActivityCreates a window, so that the user caninteract with the appCan communicate with the systemControls the higher level of the userinterface
  27. 27. Activity, get a life!The lifecycle of an Activity is really important.Listen to Lifecycle events, inorder to save and reproduce the state of the app
  28. 28. Tasks for next time1. Create an application 3. When the button is that asks for the user’s pressed, a clear button name appears that resets everything2. Then, after hitting a button, it populates a Hint: Check the text view with a following classes: personalized message TextView, EditText, for the user Button and OnClickListener