My RecyclerView in one activity is made up of an ArrayList of my custom object. Because this activity is in the edit mode, I would like to pass all the contents of this RecyclerView into another activity that is in non-edit mode. What is the best way to achieve this?
Thanks!
You don't need two activities. You can achieve your goal with a single activity.
You can use some flag like isEditMode
inside your adapter. It will be used to adapt interface for specific mode.
When you need to change mode -- just change isEditMode
field and then call adapter.notifyDataSetChanged()
.
Note. You also need change method onBindViewHolder
of your adapter to react to a mode changing. Like:
@Override
public void onBindViewHolder(@NonNull K holder, int position) {
if (isEditMode) {
// Set up item for edit mode
} else {
// Set up item for non-edit mode
}