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.