gpt4 book ai didi

android - 如何处理警告:Unchecked call to 'ObservableField(T)' as a member of raw type 'android.databinding.ObservableField'

转载 作者:行者123 更新时间:2023-11-29 23:33:30 27 4
gpt4 key购买 nike

以下代码:

public ObservableField ofFoo = new ObservableField("");

生成以下警告:

Unchecked call to 'ObservableField(T)' as a member of raw type 'android.databinding.ObservableField'

避免此警告的正确方法是什么?

最佳答案

ObservableField<String> ofFoo = new ObservableField<>("");

虽然我不明白为什么要将一个空字符串包装为一个可观察对象。

关于android - 如何处理警告:Unchecked call to 'ObservableField(T)' as a member of raw type 'android.databinding.ObservableField' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52467844/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com