已弃用的getSupportLoaderManager()的适当替代是什么? [英] What is the appropriate replacement of deprecated getSupportLoaderManager()?

查看:996
本文介绍了已弃用的getSupportLoaderManager()的适当替代是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道不赞成使用getSupportLoaderManager.但我想打电话:

I came to know that getSupportLoaderManager is deprecated. But I want to call:

getSupportLoaderManager().initLoader(0, null, mRecipeLoaderManager);

该呼叫的替代方法应该是什么? 还是我可以不用担心而仍然使用getSupportLoaderManager?

What should be an alternative to that call? Or can I still use getSupportLoaderManager without worrying?

推荐答案

如此处所述:装载机

从Android P(API 28)开始不推荐使用加载器.在处理活动和片段生命周期时,处理加载数据的推荐选项是使用ViewModels和LiveData的组合."

"Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData."

只要您看到deprecated,就直接转到开发人员api参考站点,然后查看您要查找的类或函数,以及是否有等效的替代方案.

Whenever you see something is deprecated, go directly to the developer api reference site and review the class or function for which you're looking and if there is an equivalent alternative.

这篇关于已弃用的getSupportLoaderManager()的适当替代是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆