0

My question is that I have two RecyclerView list connected to a firebase database. And I would love to transfer the clicked items to another list in the other Activity.

Given that one passenger list and when they arrive I want that Button to be clicked check-in and I want a passenger to be checked-in. I have two list reservations and the passengers already arrived. I would like to transfer those data between them.

I don't have any idea about how I can do that.

depref.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {

                for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {

                    Guest g = dataSnapshot1.getValue(Guest.class);
                    list.add(g);


                }
                adapter = new Adapter(Resden.this,list);
                rview.setAdapter(adapter);

            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {
                Toast.makeText(Resden.this,"error...", Toast.LENGTH_SHORT).show();

            }
        });
        rview.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {

                AlertDialog.Builder builder = new AlertDialog.Builder(Resden.this);
                builder.setTitle("Check in !");
                builder.setMessage("Are you sure the guest checked in?");
                builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {



                       depref.removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
                           @Override
                           public void onComplete(@NonNull Task<Void> task) {
                               if(task.isSuccessful()){
                                   Toast.makeText(Resden.this,"Succesfully checked in",Toast.LENGTH_SHORT);

                               }
                           }
                       });
                    }
                });

                return false;
            }
        });

Until here it works perfectly. After long-click I don't know how to do that.

halfer
  • 19,824
  • 17
  • 99
  • 186
Onur Aslan
  • 60
  • 4
  • What is wrong with this code? Do you have an error? – Alex Mamo Jul 27 '19 at 11:02
  • no this code until recylerview item onItemClick listener function . no more actually. I am confused about what to do. How can I transfer one item to another activity and recylerview as well. – Onur Aslan Jul 27 '19 at 18:14

0 Answers0