android made simple

41
Made Simple Made Simple

Upload: gabriel-dogaru

Post on 12-Nov-2014

1.018 views

Category:

Technology


0 download

DESCRIPTION

My presentation about Android on Codecamp nov 2012. Small introduction to android and best practices.

TRANSCRIPT

Page 1: Android Made Simple

Made SimpleMade Simple

Page 2: Android Made Simple

Who am I?Who am I?

Gabriel Dogaru

– Ex software developer at Synygy

– Ex software engineer at Amazon

– Co-founder TAGonSoft

Gabriel Dogaru

– Ex software developer at Synygy

– Ex software engineer at Amazon

– Co-founder TAGonSoft

Page 3: Android Made Simple

AgendaAgenda

● Why Android

● Small Android overview

● Leverage the power of java frameworks with Android

● Why Android

● Small Android overview

● Leverage the power of java frameworks with Android

Page 4: Android Made Simple

What is Android?What is Android?

“Android is a software stack for mobile devices

that includes an operating system, middleware

and key applications”

“Android is a software stack for mobile devices

that includes an operating system, middleware

and key applications”

Page 5: Android Made Simple

Why Android?Why Android?

Page 6: Android Made Simple

Why Android?Why Android?

● http://www.guardian.co.uk/technology/appsblog/2012/aug/16/android-winning-apps-china-smartphone is Android?● http://www.guardian.co.uk/technology/appsblog/2012/aug/16/android-winning-apps-china-smartphone is Android?

Page 7: Android Made Simple

Why Android?Why Android?

● http://www.guardian.co.uk/technology/appsblog/2012/aug/16/android-winning-apps-china-smartphone is Android?● http://www.guardian.co.uk/technology/appsblog/2012/aug/16/android-winning-apps-china-smartphone is Android?

Page 8: Android Made Simple

Why write native Android?Why write native Android?

Page 9: Android Made Simple

Why Native Android?Why Native Android?

Indeed job trends 28.10.2012Indeed job trends 28.10.2012

Page 10: Android Made Simple

Why Native Android?Why Native Android?

Indeed job trends 28.10.2012Indeed job trends 28.10.2012

Page 11: Android Made Simple

Why Native Android?Why Native Android?

Respect your userRespect your user

Page 12: Android Made Simple

Who is Android?Who is Android?

Page 13: Android Made Simple

Who is Android?Who is Android?

Page 14: Android Made Simple

Who is Android?Who is Android?

Page 15: Android Made Simple

Who is Android?Who is Android?

Page 16: Android Made Simple

Android ArchitectureAndroid Architecture

Page 17: Android Made Simple

Android ArchitectureAndroid Architecture

Page 18: Android Made Simple

Android KernelAndroid Kernel

Page 19: Android Made Simple

Native librariesNative libraries

Page 20: Android Made Simple

Android RuntimeAndroid Runtime

Page 21: Android Made Simple

Application FrameworkApplication Framework

Page 22: Android Made Simple

ApplicationsApplications

Page 23: Android Made Simple

● Activity

● Intent Receiver

● Service

● ContentProvider

● Activity

● Intent Receiver

● Service

● ContentProvider

Building BlocksBuilding Blocks

Page 24: Android Made Simple

ActivityActivity

● A single, focused thing that the user can do

● Provides a screen with which users can interact in order

to do something

● A single, focused thing that the user can do

● Provides a screen with which users can interact in order

to do something

Page 25: Android Made Simple

●Intent ReceiverIntent Receiver

● Handle the broadcast intents● Handle the broadcast intents

Page 26: Android Made Simple

ServiceService

● Can perform long-running operations in the background

and does not provide a user interface

● A component can bind to a service to interact with it

● Can perform long-running operations in the background

and does not provide a user interface

● A component can bind to a service to interact with it

Page 27: Android Made Simple

Content providerContent provider

● Enable applications to share data● Enable applications to share data

Page 28: Android Made Simple

IntentIntent

● Passive data structure holding an abstract description of

an operation to be performed

● Used to start your activities

● Used to start external applications

● Passive data structure holding an abstract description of

an operation to be performed

● Used to start your activities

● Used to start external applications

Page 29: Android Made Simple

That's just old stuff from 2008That's just old stuff from 2008

● http://developer.android.com

● http://www.youtube.com/results?search_query=androidology

● blogs++

● http://developer.android.com

● http://www.youtube.com/results?search_query=androidology

● blogs++

Page 30: Android Made Simple

How about my handy Java frameworks?How about my handy Java frameworks?

Page 31: Android Made Simple

The Best Programmers Are The Best Programmers Are LazyLazy and Dumb ?!?!? and Dumb ?!?!?

Page 32: Android Made Simple

Android annotationsAndroid annotations

Page 33: Android Made Simple

Helps with activitiesHelps with activities

@NoTitle@Fullscreen@EActivity(R.layout.bookmarks)public class BookmarksToClipboardActivity extends Activity { @ViewById ListView bookmarkList; @ViewById EditText search; @AfterViews void initBookmarkList() { search.setText(??);//..... }

Page 34: Android Made Simple

Helps with eventsHelps with events

//.....

@Click( {R.id.button1, R.id.button2})

void updateBookmarksClicked() {

searchAsync(search.getText().toString(),userid);

}

@ItemClick

void bookmarkListItemClicked(Bookmark selectedBookmark) {

clipboardManager.setText(selectedBookmark.getUrl());

}

//.....

//.....

@Click( {R.id.button1, R.id.button2})

void updateBookmarksClicked() {

searchAsync(search.getText().toString(),userid);

}

@ItemClick

void bookmarkListItemClicked(Bookmark selectedBookmark) {

clipboardManager.setText(selectedBookmark.getUrl());

}

//.....

Page 35: Android Made Simple

Helps with preferences Helps with preferences

@SharedPref

public interface MyPrefs {

@DefaultString("John")

String name();

@DefaultInt(42)

int age();

long lastUpdated();

}

…...............................

@EActivity

public class MyActivity extends Activity {

@Pref

MyPrefs_ myPrefs;

}

@SharedPref

public interface MyPrefs {

@DefaultString("John")

String name();

@DefaultInt(42)

int age();

long lastUpdated();

}

…...............................

@EActivity

public class MyActivity extends Activity {

@Pref

MyPrefs_ myPrefs;

}

Page 36: Android Made Simple

Helps with Rest ServicesHelps with Rest Services

@Rest("http://tagonsoft.ro/")

public interface CodecampClient {

@Get("codecamp.php")

@Accept(MediaType.APPLICATION_JSON)

Codecamp getEventData();

@Post("feedback.php")

void sendFeedback(Feedback feedback);

RestTemplate getRestTemplate();

}

@Rest("http://tagonsoft.ro/")

public interface CodecampClient {

@Get("codecamp.php")

@Accept(MediaType.APPLICATION_JSON)

Codecamp getEventData();

@Post("feedback.php")

void sendFeedback(Feedback feedback);

RestTemplate getRestTemplate();

}

Page 37: Android Made Simple

Got ORM? OrmLite Got ORM? OrmLite

@DatabaseTable(tableName = "sessions")

public class Session {

@DatabaseField(id = true, columnName = "_id")

long id;

//....

}

//....

TableUtils.createTable(connectionSource, Session.class);

//....

dbHelper.getSessionDao().create(session);

dbHelper.getSessionDao().queryForId(sessionID);

@DatabaseTable(tableName = "sessions")

public class Session {

@DatabaseField(id = true, columnName = "_id")

long id;

//....

}

//....

TableUtils.createTable(connectionSource, Session.class);

//....

dbHelper.getSessionDao().create(session);

dbHelper.getSessionDao().queryForId(sessionID);

Page 38: Android Made Simple

And it all builds upAnd it all builds up

Page 39: Android Made Simple

So?So?

● Android is the world's most popular mobile platform

● Writing Android code can be fun and easy

● developer.android.com is your friend

● You can download example Codecamp app source code from

https://bitbucket.org/gdogaru/codecamp_android

● Android is the world's most popular mobile platform

● Writing Android code can be fun and easy

● developer.android.com is your friend

● You can download example Codecamp app source code from

https://bitbucket.org/gdogaru/codecamp_android

Page 40: Android Made Simple
Page 41: Android Made Simple

Thank You!Thank You!

Please fill in the evaluation formsPlease fill in the evaluation forms

[email protected]

tagonsoft.ro