简体   繁体   中英

Send Data From RecyclerView To Fragment

I'm trying to send information from a Activity to a RecyclerView & I'm successful, but I'm failing to send information from RecyclerView to the second Fragment. Let me be clearer :

DetailsActivity extends AppCompatActivity  implements CallbackToActivity

TO:

RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder>

TO:

GetDetailsFragment extends Fragment

I cant use Intent because the information from the Recycler is not sent to the Fragment For the second time, I can't send the information using the bundle and getArguments to Fragment because it does not accept the use of Arguments in the Recycler. I need to send the information like this so if you have any solution, please tell me

Communication to fragment chould be done via activity.

1.send information back to activity. 2.call the method of the fragment from activity and pass the information received from recyclerview.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM