~ubuntuone-client-engineering/droidcouch/trunk

« back to all changes in this revision

Viewing changes to src/se/msc/android/droidcouch/ubuntuone/samples/RetrieveNotesTask.java

  • Committer: Alejandro J. Cura
  • Date: 2011-03-04 18:41:37 UTC
  • Revision ID: git-v1:0525d317e62e1ea56dcbaaf784da11e2e6fcdb44
Documentation for all DroidCouch and UbuntuOneDroidCouch classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import se.msc.android.droidcouch.ubuntuone.UbuntuOneDroidCouch;
7
7
import android.os.AsyncTask;
8
8
 
 
9
/**
 
10
 * Sample task that retrieves the notes DB from the Ubuntu One CouchDB servers.
 
11
 * It also sends the result data to the activity that invoked this.
 
12
 * 
 
13
 * @author Alejandro J. Cura <alecu@canonical.com>
 
14
 */
9
15
public class RetrieveNotesTask extends AsyncTask<Void, Void, JSONObject> {
10
16
 
11
17
        private final SampleUbuntuOneNotesViewer activity;
12
18
 
 
19
        /**
 
20
         * Construct this task
 
21
         * @param activity the activity that is running this task
 
22
         */
13
23
        public RetrieveNotesTask(SampleUbuntuOneNotesViewer activity) {
14
24
                this.activity = activity;
15
25
        }
16
26
 
 
27
        /* This gets executed in a background thread, so it does not block the UI thread. 
 
28
         */
17
29
        @Override
18
30
        protected JSONObject doInBackground(Void... params) {
19
31
                DroidCouch droidCouch;
27
39
                }
28
40
        }
29
41
 
 
42
        /* This part gets executed in the UI thread, so it can update UI elements. 
 
43
         */
30
44
        @Override
31
45
        protected void onPostExecute(JSONObject result) {
32
46
                super.onPostExecute(result);