From b252273014c1c561a3e3981ac1dc41cd4b4f4729 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 26 Oct 2010 12:47:13 -0700 Subject: [PATCH] Update to follow API. Also a new list demo. Change-Id: I0c59fc6f50009fcba183f0b5af61ec50d5888240 --- samples/ApiDemos/AndroidManifest.xml | 7 +++ .../android/apis/content/ClipboardSample.java | 2 +- .../com/example/android/apis/view/List17.java | 57 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 samples/ApiDemos/src/com/example/android/apis/view/List17.java diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml index d0d80eb01..6a2455325 100644 --- a/samples/ApiDemos/AndroidManifest.xml +++ b/samples/ApiDemos/AndroidManifest.xml @@ -1406,6 +1406,13 @@ + + + + + + + diff --git a/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java b/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java index e369ca9eb..6b840507f 100644 --- a/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java +++ b/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.java @@ -118,7 +118,7 @@ public class ClipboardSample extends Activity { void updateClipData() { ClipData clip = mClipboard.getPrimaryClip(); - String[] mimeTypes = clip != null ? clip.filterMimeTypes("*/*") : null; + String[] mimeTypes = clip != null ? clip.getDescription().filterMimeTypes("*/*") : null; mMimeTypes.setText(""); if (mimeTypes != null) { for (int i=0; i(this, + android.R.layout.simple_list_item_activated_1, mStrings)); + getListView().setTextFilterEnabled(true); + + // Tell the list view to show one checked/activated item at a time. + getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); + + // Start with first item activated. + // Make the newly clicked item the currently selected one. + getListView().setItemChecked(0, true); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + // Make the newly clicked item the currently selected one. + getListView().setItemChecked(position, true); + } + + private String[] mStrings = Cheeses.sCheeseStrings; +}