Lorsque j'essaie de récupérer des données de Firestore en utilisant FirestoreRecyclerAdapter
ça ne se voit pas.
Journal des erreurs
Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
Code Java
//FirebaseFireStore Variable
firebaseFirestore = FirebaseFirestore.getInstance();
//RecyclerView Variable
recyclerView = findViewById(R.id.recyclerViewId);
//Query
Query query = firebaseFirestore.collection("root");
//RecyclerOption
FirestoreRecyclerOptions<TestModel> options = new FirestoreRecyclerOptions.Builder<TestModel>()
.setQuery(query, TestModel.class)
.build();
//FirestoreRecyclerAdapter
adapter = new FirestoreRecyclerAdapter<TestModel, MyTestViewHolder>(options) {
@NonNull
@Override
public MyTestViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.test_item, parent, false);
return new MyTestViewHolder(view);
}
@Override
protected void onBindViewHolder(@NonNull TestActivity.MyTestViewHolder holder, int position, @NonNull TestModel model) {
holder.tit.setText(model.getmTitle());
holder.sto.setText(model.getmStory());
}
};
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
private class MyTestViewHolder extends RecyclerView.ViewHolder {
TextView tit, sto;
public MyTestViewHolder(@NonNull View itemView) {
super(itemView);
tit = itemView.findViewById(R.id.testTitleId);
sto = itemView.findViewById(R.id.testStoryId);
}
}
@Override
protected void onStart() {
super.onStart();
adapter.startListening();
}
@Override
protected void onStop() {
super.onStop();
adapter.stopListening();
}
ModèleClasse
String mTitle, mStory;
public TestModel(String mTitle, String mStory) {
this.mTitle = mTitle;
this.mStory = mStory;
}
private TestModel(){}
public String getmTitle() {
return mTitle;
}
public void setmTitle(String mTitle) {
this.mTitle = mTitle;
}
public String getmStory() {
return mStory;
}
public void setmStory(String mStory) {
this.mStory = mStory;
}
FireStore Concole