Android 无法解析方法';setQuery(com.google.firebase.database.DatabaseReference,java.lang.Class<;com.myapp.Contacts>;,
我需要传递UserRef和Contacts.class,但出现此消息,我如何传递这些信息?有人能帮我吗 错误Android 无法解析方法';setQuery(com.google.firebase.database.DatabaseReference,java.lang.Class<;com.myapp.Contacts>;,,android,android-studio,Android,Android Studio,我需要传递UserRef和Contacts.class,但出现此消息,我如何传递这些信息?有人能帮我吗 错误无法解析方法“setQuery(com.google.firebase.database.DatabaseReference,java.lang.Class,com.google.firebase.database.Query,匿名com.firebase.ui.database.SnapshotParser)” private void fetch(查询){ FirebaseRecycl
无法解析方法“setQuery(com.google.firebase.database.DatabaseReference,java.lang.Class,com.google.firebase.database.Query,匿名com.firebase.ui.database.SnapshotParser)”
private void fetch(查询){
FirebaseRecyclerOptions选项=
新的FirebaseRecyclerOptions.Builder()
.setQuery(UsersRef,Contacts.class,query,new SnapshotParser(){
@RequiresApi(api=Build.VERSION\u CODES.KITKAT)
@非空
@凌驾
公共联系人解析快照(@NonNull DataSnapshot snapshot){
返回新联系人(Objects.requirennoull(snapshot.child(“name”).getValue()).toString(),
Objects.requirennull(snapshot.child(“status”).getValue().toString());
}
})
private void fetch(Query query) {
FirebaseRecyclerOptions<Contacts > options =
new FirebaseRecyclerOptions.Builder<Contacts>()
.setQuery(UsersRef, Contacts.class,query, new SnapshotParser<Contacts>() {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@NonNull
@Override
public Contacts parseSnapshot(@NonNull DataSnapshot snapshot) {
return new Contacts(Objects.requireNonNull(snapshot.child("name").getValue()).toString(),
Objects.requireNonNull(snapshot.child("status").getValue()).toString());
}
})