S
S
Shohrukh Alimov2017-04-02 19:45:15
Android
Shohrukh Alimov, 2017-04-02 19:45:15

How to get text from multiple Edittext inside Recyclerview?

public class Guests_Adapter extends RecyclerView.Adapter<Guests_Adapter.MyViewHolder> {

    private List<BookingData_GS> guests_List;
    private Context context;

    class MyViewHolder extends RecyclerView.ViewHolder {
        EditText guestFullName;

        private MyViewHolder(View view) {
            super(view);
            guestFullName = (EditText) view.findViewById(R.id.guestsName);
        }
    }

    public Guests_Adapter(Context context, List<BookingData_GS> guests_List) {
        this.context = context;
        this.guests_List = guests_List;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.z_row_guests, parent, false);

        return new MyViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        BookingData_GS guest_gs = guests_List.get(position);
//        holder.guestFullName.getText().toString(); ???????
    }

    @Override
    public int getItemCount() {
        return guests_List.size();
    }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Gamega, 2017-04-03
@AlimNinja

Associate the view with the model, as soon as the user has entered the text, he should immediately get into the model, and already get it out of the model

S
Sergey Vashchenko, 2017-04-03
@Simipa

Use eventBus, create a class with multiple parameters, and dispatch that class. Well, write methods for receiving parameters in the adapter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question