Android Workshop hosted by Antonis Kalipetis, organized by EESTEC LC Athens - 2014.
Agenda:
• Intro to OOP and Java
• Intro to the Android Platform
• Setting up Android Studio
• Running a simple application
• Creating a simple layout
2. W H AT T H E S E
WORKSHOPS ARE
NOT FOR
• Being a pro in two weeks
!
• Learning without trying
!
• Knowing everything out
there
3. W H AT W E A R E G O I N G T O L E A R N
• General knowledge of the platform
• Simple application creation
• Learn how to search
4. GOOGLE IS YOUR FRIEND
A N D S TA C K O V E R F L O W T O O !
5. AGENDA
• Intro to OOP and Java
• Intro to the Android Platform
• Setting up Android Studio
• Running a simple application
• Creating a simple layout
7. • Code decoupling, enforces code reusability
• Associates data structures with their related methods
• Makes real-world object representation easier
8. L E T ’ S S A Y I T ’ S A B L U E P R I N T, I T ’ S A W A Y T O R E P R E S E N T D A TA
A CLASS
9. C E R TA I N D A TA R E P R E S E N TA T I O N , I N M E M O R Y !
OBJECT
10. CLASS
EXTENSION
• Classes can extend other
classes
• They inherit their
attributes and methods
• Can extend only one
class
11. public class Car {
public int maxSpeed;
public int currentSpeed;
!
public void accelerate(int speed) {
int tmpSpeed = currentSpeed + speed;
if (tmpSpeed < maxSpeed) {
currentSpeed = tmpSpeed;
} else {
currentSpeed = maxSpeed;
}
}
}
!
public class Truck extends Car {
public int trailers;
public int maxTrailers;
!
}
public void addTrailer() {
if (trailers < maxTrailers) {
trailers++;
}
}
12. F U N C T I O N A L I T Y PA C K S - A C T I O N D E S C R I P T I O N S
I N T E R FA C E S
13. public class Car {
// …
}
!
public interface MilitaryUnit {
abstract void startShooting();
}
!
public class MilitaryCar extends Car implements
MilitaryUnit {
@Override
public void startShooting() {
System.out.println("Bang, Bang!");
}
}
16. J AVA
AT A G L A N C E
C-like syntax
Created in Sun Microsystems
Now acquired by Oracle
17. public class HelloWorldJava {
public static void main(String[] args) {
System.out.prinln("Hello, World!”);
}
}
18. G R E AT T H I N G S A B O U T J A V A
• Garbage collector, (almost) good bye memory leaks!
• Shit happens, except exceptions!
• Platform independent, runs on JVM, (or maybe
Dalvik!)
21. W H AT I S
ANDROID
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
23. ACTIVITY
• Creates a window, so that
the user can interact with
the app
• Can communicate with the
system
• Controls the hierarchy of
the user interface