处理德precated android.text.ClipboardManagerandroid、precated、ClipboardManager、text

2023-09-06 04:06:06 作者:夏有乔木

android.text.ClipboardManager 是因为空气污染指数11日precated,并与 android.content.ClipboardManager (源)。

android.text.ClipboardManager was deprecated since API level 11, and replaced with android.content.ClipboardManager (source).

我如何编写支持这两种情况下code?导入 android.content.ClipboardManager 和使用工作在11+,但武力10.关闭改变进口 android.text.ClipboardManager 抛出一堆去precation警告11 +。

How do I write code that supports both cases? Importing android.content.ClipboardManager and using that works in 11+ but force closes in 10. Changing the import to android.text.ClipboardManager throws a bunch of deprecation warnings in 11+.

我怎样才能顺利地处理这两种情况?我需要做什么导入?

How can I handle both cases smoothly? What do I need to import?

推荐答案

我最终只是用旧的方式(android.text.ClipboardManager和this回答),以及一对夫妇@燮pressWarnings(德precation)标注。

I ended up just using the old way (android.text.ClipboardManager and the code from this answer), along with a couple @SuppressWarnings("deprecation") annotations.