- switch (menuItemId) {
- case R.id.copy:
- // Get the about version string.
- String aboutVersionString = getAboutVersionString();
-
- // Get a handle for the clipboard manager.
- ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
-
- // Remove the incorrect lint error below that the clipboard manager might be null.
- assert clipboardManager != null;
-
- // Save the about version string in a clip data.
- ClipData aboutVersionClipData = ClipData.newPlainText(getString(R.string.about), aboutVersionString);
-
- // Place the clip data on the clipboard.
- clipboardManager.setPrimaryClip(aboutVersionClipData);
+ if (menuItemId == R.id.copy) { // Copy.
+ // Get the about version string.
+ String aboutVersionString = getAboutVersionString();