I Need to get Firebase Realtime Database Data Using Spinner.
Like Spinner - Product Name
After selecting Product Name need to fetch data automatically Rate and Stock Quantity
public class ChrompetSalesFillAdapter extends RecyclerView.Adapter<ChrompetSalesFillAdapter.MyViewHolder> {
Context context;
ArrayList<Model> fill_list;
public ChrompetSalesFillAdapter(Context context, ArrayList<Model> fill_list){
this.context = context;
this.fill_list = fill_list;
}
@NonNull
@Override
public ChrompetSalesFillAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.sales_report_row, parent, false);
return new ChrompetSalesFillAdapter.MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ChrompetSalesFillAdapter.MyViewHolder holder, int position) {
Model model = fill_list.get(position);
holder._stock_qty.setText(model.getProduct_stock_qty());
holder._product_rate.setText(model.getProduct_rate());
holder._product_id.setText(model.getProduct_id());
}
@Override
public int getItemCount() {
return fill_list.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
TextView _product_rate, _stock_qty,_product_name,_product_id;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
_product_name = itemView.findViewById(R.id.product_name_sales_fill);
_product_id =itemView.findViewById(R.id.pro_id_sales_fill);
_product_rate = itemView.findViewById(R.id.rate_chr_sales_fill);
_stock_qty = itemView.findViewById(R.id.stock_chr_sales_fill);
}
}
}
I think it possible with do like this
Let me know if you dont understand
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.