aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils/ClipboardUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/utils/ClipboardUtils.java')
-rw-r--r--main/src/cgeo/geocaching/utils/ClipboardUtils.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/utils/ClipboardUtils.java b/main/src/cgeo/geocaching/utils/ClipboardUtils.java
index 6be5b7f..fb30886 100644
--- a/main/src/cgeo/geocaching/utils/ClipboardUtils.java
+++ b/main/src/cgeo/geocaching/utils/ClipboardUtils.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.utils;
import cgeo.geocaching.CgeoApplication;
+import org.eclipse.jdt.annotation.Nullable;
+
import android.content.Context;
/**
@@ -33,10 +35,12 @@ public final class ClipboardUtils {
*
*/
@SuppressWarnings("deprecation")
+ @Nullable
public static String getText() {
// fully qualified name used here to avoid buggy deprecation warning (of javac) on the import statement
final android.text.ClipboardManager clipboard = (android.text.ClipboardManager) CgeoApplication.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
- return clipboard.getText().toString();
+ final CharSequence text = clipboard.getText();
+ return text != null ? text.toString() : null;
}
}