This app is intended to be used for testing ODK Collect app and presenting how to open activities of ODK Collect directly from an external app.
ODK Collect offers us to open a bunch of it's activities from another app. You can open a specific form or one of existed lists (list of empty forms, saved forms, finalized forms, sent forms).
Thanks to that you can build your own app that interact with ODK Collect through intents.
If you want to start ODK Collect's activity you need to:
- Create a new intent using an appropriate action.
- Set the typ of created intent.
- Start an activity using the intent.
The code should looks like below (in this case it's the Form Chooser list):
public void startFormChooserList(View view) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setType(FORMS_CHOOSER_INTENT_TYPE);
startActivityIfAvailable(i);
}
where
FORMS_CHOOSER_INTENT_TYPE = "vnd.android.cursor.dir/vnd.odk.form";
You can find all the other examples in MainActivity or ListActivity.
On the other side you can also open other apps from ODK Collect, for example in order to read a value - see the ODK Counter.
Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.html