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

Preview:

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.

Citation preview

ANDROID III

CONTACTSYLWESTER MADEJ@smdremedysmd@soldiersofmobile.com

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

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

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!”

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

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

DEMO

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

TOOLS: HIERARCHY VIEWER

Second approach :)

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!

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

FOR MORE GO TO:SoldiersOfMobile.com

Recommended