practical android course part iii - rest api with aquery, preferences, android studio

12
ANDROID III

Upload: sylwester-madej

Post on 23-Jun-2015

886 views

Category:

Technology


0 download

DESCRIPTION

Entire course: http://soldiersofmobile.com/android-course/ Introduction to: - REST API - AQuery lib (AJAX Calls) - Shared Preferences + homework Source code used can be found at: https://github.com/smdremedy/kni-lunchtime This is a third part of Practical Android Course conducted at Warsaw University of Technology.

TRANSCRIPT

Page 1: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

ANDROID III

Page 2: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

CONTACTSYLWESTER MADEJ@[email protected]

Page 3: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

TODAY'S MISSION● Embrace The Android Studio● Learn how REST API works● Get to know AQuery● Save data on device with Preferences● Work with Cookies

Page 4: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

RESTfull WEB API● Used by more and more● REpresentational State Transfer● HTTP Verbs: GET, POST, PUT,DELETE● Test: Postman (chrome), REST Client (FF)

Page 5: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

AQuery● https://code.google.com/p/android-query/

“Android-Query (AQuery) is a light-weight library for doing asynchronous tasks and manipulating UI elements in Android. Our goal is to make Android

coding simpler, easier, and more fun!”

Page 6: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

AQuery – AJAX POSTMap<String, Object> params = new HashMap<String, Object>();

params.put("q", "androidquery");

aq.ajax("http://search.twitter.com/search.json", params, JSONObject.class,

new AjaxCallback<JSONObject>() {

@Override public void callback(String url, JSONObject json, AjaxStatus status) { } });

Page 7: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

AQuery – Images● Async ImageView load from url

//load an image to an ImageView from network, cache image to file and memory

aq.id(R.id.image1).image("http://www.vikispot.com/z/images/vikispot/android-w.png");● Cache in mem and storage● Reduce size● Provide placeholders

Page 8: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

DEMO

Go, Go, Go!● Details layout● Login● Save session and user_id● Load items● Place and cancel orders● Show image● Logout

Page 9: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

TOOLS: HIERARCHY VIEWER

Second approach :)

Page 10: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

HOMEWORK IIIHomework:

Do Tumblr browser for http://wehavethemunchies.tumblr.com/

Use Tumblr REST API (free signup required)

http://www.tumblr.com/docs/en/api/v2

Try to make it simillar to web (display links, maybe tags).

Pro version: Do endless scroll!

Page 11: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

NEXT MISSION● Suntan ;)● Introducing: Gram of Art● UI pro tips from Paweł

Page 12: Practical Android Course Part III - REST API with AQuery, Preferences, Android Studio

FOR MORE GO TO:SoldiersOfMobile.com