Answer the question
In order to leave comments, you need to log in
How to pass a value to a specific fragment through EventBus?
There is an activity of two fragments. Each fragment is a subscriber and receives data as an Integer. How to send an Integer from an activity to a specific fragment if both fragments have a common signature.
Fragment1-2
@Subscribe
public void onEvent(Integer event){
Log.d("eventbus", ""+event);
Toast.makeText(getActivity(), "Получено число:" + event, Toast.LENGTH_SHORT).show();
}
EventBus.getDefault().post(6);
Answer the question
In order to leave comments, you need to log in
obviously to make a different signature?
just wrap the original fragment:
Fragment1 extends CommonFragment
and
Fragment2 extends CommonFragment
and pass the class with the parameter to whom in the event
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question