English 中文(简体)
如何重新确定优先选择。 java 档案
原标题:How to reset the prefereceManager.java file

我刚刚开始安乐施方案,我是编码的起点。 我首先要谈谈这一错误。

` getDefaultSharedPreferences(android.content.Context)  is deprecated.`


并且通过进入来文方,获得违约。 共用参比没有,通知出现在网页顶上,我下载了。

`public static SharedPreferences getDefaultSharedPreferences(Context context) {
         return context.getSharedPreferences(getDefaultSharedPreferencesName(context),
                 getDefaultSharedPreferencesMode());
     }`

It was added, but after this, the prefereceManager.java file got an error. There are 54 errors that I don t know what to do. Please guide me how to return the prefereceManager.java file to its original state

问题回答

首先,你看到的最初一点是警告,而不是错误。 当某项职能被解释时,这意味着它建议不再使用,而且可能不适当工作。 如果看看这些文件,一般会告诉你什么是用的。 The documentation is here: https://developer.android.com/fer/p参比/P参半

In this case, as of Android SDK version 29, the entire PreferenceManager class is deprecated. Instead, you re directed to use the androidx implementation. What happened is Google decided to take a bunch of classes that were part of the SDK but not core OS functionality and remove it from the SDK, into a separate library. That made it easier to push updates to it, as updating the SDK requires an OS update and not just a library update. The implementation remains the same, you just need to use the androidx version. See https://developer.android.com/develop/ui/views/components/settings for examples.

因此,你们有两种选择,要么真正做到:

(1) 港口使用Anderson PvissManager。 这是首选方案。

(2) 警告和使用旧的 st。 它将继续工作好几年,但是,除非有安全考虑,否则它可能得不到进入海底的更新。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签