我在数据库中有'semester'子代,现在我想用'semester'子代检查两个值。 如果一个学期的成绩为“第四”或“一般反馈”,则数据将被检索到回收站适配器
`最终的FirebaseRecyclerOptions选项=新的FirebaseRecyclerOptions.Builder() .setQuery(mdatabase.orderByChild(“ semester”),feeds.class) .build();
final FirebaseRecyclerAdapter<feeds, myfeedback.holder> adapter = new FirebaseRecyclerAdapter<feeds, holder>(options) {
@Override
public void onBindViewHolder(final myfeedback.holder holder, final int position, final feeds model) {
holder.setIsRecyclable(false);
int count = 0;
final String fkey = getRef(position).getKey();
holder.semester.setText(model.getSemester());
holder.feedback.setText(model.getFeedback());
try {
long millisecond = model.getTimestamp();
String dateString = DateFormat.format("MM/dd/yyyy", new Date(millisecond)).toString();
holder.date.setText(dateString);
} catch (Exception e) {
Toast.makeText(myfeedback.this, "Exception : " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent vfintent = new Intent(myfeedback.this, viewfeed.class);
vfintent.putExtra("fid", fkey);
startActivity(vfintent);
}
});
}
@Override
public myfeedback.holder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.mfeed_row, parent, false);
myfeedback.holder ViewHolder = new myfeedback.holder(view);
return ViewHolder;
}
};
`
我的数据库看起来像这样。 饲料 { uniqueid1 { 反馈:“某事” 学期:“第四” } uniqueid2 { 反馈:“某事” 学期:“第五” } uniqueid3 { 反馈:“某事” 学期:“第四” } uniqueid4 { 反馈:“某事” 学期:“一般反馈” } }