Is there a way to combine the results of the events into one and hand them over to other classes?

Asked 2 years ago, Updated 2 years ago, 118 views

For example, in the class Fragment 1, there are various events [Spinner, Switch, SeekBar] and so on

Is there a way to put the initial values of these events together and put them in Message.obj and send them to another class [for example, I'll do Fragment2 here?]

Of course Fragment 1 is referring to Fragment 2.

class interface

2022-09-22 18:18

1 Answers

What does Fragment 1 mean by referring to Fragment 2? I don't know if you don't know how to communicate between Fragments or how to communicate between Activities, so I'm answering two questions.

Communication between activities is possible through Intent. Refer to parcelble for object data communication via int.

Communication between Fragments is possible through Activity, which acts as a controller. The form of creating an interface in each fragment and implementing it in Activity. Please refer to the following link. Move link

I hope it was answered.


2022-09-22 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.