MAP524/DPS924 Lecture 8

From CDOT Wiki
Revision as of 13:49, 2 August 2015 by Andrew (talk | contribs) (Created page with '= Content Providers = This week we're looking at another means of sharing data between Android apps, this one is usually used for well structured data with a stable API for acce…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Content Providers

This week we're looking at another means of sharing data between Android apps, this one is usually used for well structured data with a stable API for accessing it. But first..

A look back at Intents

Most of you have only used an intent to start an activity, and haven't thought much about the Intent object. Today let's use a couple of features available with an intent, specifically for passing data to the activity being started and getting data back from it.

This tutorial is pretty good, it talks about how to use the Intent to pass data to and receive it in an Activity. Android Studio autocomplete will help you see what other types of data you can pass.

To get data back from an activity you started you need to use startActivityForResult() instead of startActivity(), see here for an explanation and example.