I have 2 Recyclerviews inside 2 different Fragments contained in a ViewPager. When a card in my RecyclerviewA is clicked I would like to pass the respective object over to RecyclerviewB currently I have an onClick in RecyclerView with the following code:
@Override
public void onBindViewHolder(ViewHold holder, int position) {
holder.nameTextView.setText(list.get(position).getString("name"));
holder.addressTextView.setText(list.get(position).getString("fromAddress"));
final int pos = position;
holder.acceptButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ApplicationClass.bus.post(list.get(pos));
}
});
In RecyclerViewB I have
public PickupListAdapter(Context context, List<ParseObject> ddList) {
this.ddList = ddList;
this.mContext = context;
ApplicationClass.bus.register(mContext);
}
@Subscribe
public void answerAvailable(ParseObject object) {
ddList.add(object);
notifyDataSetChanged();
}
Inside my Application Class I have:
public static Bus bus;
@Override
public void onCreate(){
super.onCreate();
bus = new Bus(ThreadEnforcer.MAIN);
}
The "answerAvailable" method is not called. What is currently incorrect regarding my implementation?