Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I should start by saying I am fairly new to android as well and made up something recently for a project I started but didn't get around to finishing yet. The API portion is fairly complete and can be adapted to most other APIs. I specifically built it around providing methods of callback to the interface post response from the API. Here's a link to the code <a href="http://ftp-ns-drop.com/stack/api.zip" rel="nofollow">http://ftp-ns-drop.com/stack/api.zip</a>, Included is one of my activities called LoginActivity. I included it so you could see how the api calls are invoked and how they are received.</p> <p>Heres my class structure.</p> <p>APIClient - this class contains all my methods for creating api calls like login(username, password, callback), the credentials for our current session and our HTTPClient.</p> <p>APITask - The actual AsyncTask(<a href="http://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">http://developer.android.com/reference/android/os/AsyncTask.html</a>) that handles the execution of our http request and then passes back the result to our APIClient. the async task is of course important to allow the GUI thread to continue to execute while the request is being processed.</p> <p>APICallback - An interface that can be added using annotations to any class, the class is then passed to the APIClient when requests are made and a method then serves as a callback for the API. (note: I made this an annotation interface not because it has to be but because I wanted an excuse to use annotations :), It may make more sense to just make it an interface)</p> <p>JSONResponse - The response for any API call, contains the HTTP request, the HTTP response and the data response, this is passed back to the callback method defined by APICallback.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload