Open main menu

CDOT Wiki β

Changes

MAP524/DPS924 Lecture 8

1,031 bytes added, 12:49, 2 August 2015
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…'
= 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.

[http://developer.android.com/intl/ja/training/basics/firstapp/starting-activity.html 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(), [http://developer.android.com/intl/ja/reference/android/app/Activity.html#StartingActivities see here] for an explanation and example.