android made simple

Post on 12-Nov-2014

1.025 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Made SimpleMade 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

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

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”

Why Android?Why Android?

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?

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?

Why write native Android?Why write native Android?

Why Native Android?Why Native Android?

Indeed job trends 28.10.2012Indeed job trends 28.10.2012

Why Native Android?Why Native Android?

Indeed job trends 28.10.2012Indeed job trends 28.10.2012

Why Native Android?Why Native Android?

Respect your userRespect your user

Who is Android?Who is Android?

Who is Android?Who is Android?

Who is Android?Who is Android?

Who is Android?Who is Android?

Android ArchitectureAndroid Architecture

Android ArchitectureAndroid Architecture

Android KernelAndroid Kernel

Native librariesNative libraries

Android RuntimeAndroid Runtime

Application FrameworkApplication Framework

ApplicationsApplications

● Activity

● Intent Receiver

● Service

● ContentProvider

● Activity

● Intent Receiver

● Service

● ContentProvider

Building BlocksBuilding Blocks

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

●Intent ReceiverIntent Receiver

● Handle the broadcast intents● Handle the broadcast intents

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

Content providerContent provider

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

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

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++

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

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

Android annotationsAndroid annotations

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(??);//..... }

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());

}

//.....

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;

}

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();

}

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);

And it all builds upAnd it all builds up

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

Thank You!Thank You!

Please fill in the evaluation formsPlease fill in the evaluation forms

gdogaru@gmail.comgabrieldogaru.com

tagonsoft.ro

top related