diff --git a/samples/ApiDemos/res/layout/intents.xml b/samples/ApiDemos/res/layout/intents.xml index aed709d76..e301b0bdf 100644 --- a/samples/ApiDemos/res/layout/intents.xml +++ b/samples/ApiDemos/res/layout/intents.xml @@ -17,7 +17,8 @@ - @@ -29,9 +30,22 @@ + + + + diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml index 897d67a89..8fd182a7f 100644 --- a/samples/ApiDemos/res/values/strings.xml +++ b/samples/ApiDemos/res/values/strings.xml @@ -467,6 +467,8 @@ App/Activity/Intents Example of launching various Intents. Get Music + Get Image + Get Stream diff --git a/samples/ApiDemos/src/com/example/android/apis/app/Intents.java b/samples/ApiDemos/src/com/example/android/apis/app/Intents.java index 8f02b8322..6207dd805 100644 --- a/samples/ApiDemos/src/com/example/android/apis/app/Intents.java +++ b/samples/ApiDemos/src/com/example/android/apis/app/Intents.java @@ -31,17 +31,23 @@ public class Intents extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.intents); - - // Watch for button clicks. - Button button = (Button)findViewById(R.id.get_music); - button.setOnClickListener(mGetMusicListener); } - private OnClickListener mGetMusicListener = new OnClickListener() { - public void onClick(View v) { - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.setType("audio/*"); - startActivity(Intent.createChooser(intent, "Select music")); - } - }; + public void onGetMusic(View view) { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("audio/*"); + startActivity(Intent.createChooser(intent, "Select music")); + } + + public void onGetImage(View view) { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("image/*"); + startActivity(Intent.createChooser(intent, "Select image")); + } + + public void onGetStream(View view) { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("*/*"); + startActivity(Intent.createChooser(intent, "Select stream")); + } }