'How to Pass data from TextView to CardView in Recyclerview which already have data from FireStore
I am new to Android Studio and I am facing a challenge.
I have FireStore database and I retrieve the data to Textview inside CardView in the Recyclerview and "it works well" in Result_Activity.
In the same Result_Activity, I have Textview that gets x-Number from other activity "Put & Get extras", "and it works well also".
My problem is, I want to pass this x-Number from Textview to Textview inside the Cardview to be shown in the Recyclerview.
And the final result is Cardview with "Data from FireStore in 3 TextView & x-Number in 1 TextView".
I tried to search many examples but nothing work. Is there any way to do this and also I hope there is an example for me to understand how it can be done.
The FirestoreRecyclerAdapter
public class BIRAdaptor extends FirestoreRecyclerAdapter {
public BIRAdaptor(@NonNull FirestoreRecyclerOptions<BIR> options) {
super(options);
}
@Override
protected void onBindViewHolder(@NonNull BIRAdaptor.BRHolder holder, int position, @NonNull BIR model) {
holder.textViewName.setText(model.getName());
holder.textViewEmail.setText(model.getEmail());
holder.textViewInD.setText(model.getInD());
holder.textViewYs.setText(String.valueOf(model.getYs())); }
@NonNull
@Override
public BIRAdaptor.BRHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.rslt_item, parent, false);
return new BIRAdaptor.BRHolder(v); }
public void deleteB(int position){
getSnapshots().getSnapshot(position).getReference().delete(); }
class BRHolder extends RecyclerView.ViewHolder {
TextView textViewName;
TextView textViewEmail;
TextView textViewInD;
TextView textViewYs;
TextView ttlIns;
public BRHolder(@NonNull View itemView) {
super(itemView);
textViewName =itemView.findViewById(R.id.text_view_name);
textViewEmail = itemView.findViewById(R.id.text_view_email);
textViewInD = itemView.findViewById(R.id.text_view_inD);
textViewYs = itemView.findViewById(R.id.text_view_ys);
//x-Number
ttlIns = itemView.findViewById(R.id.text_ins);
}}}
How to pass the x-Number from textview to Adapter?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|