Chicowitz
Chicowitz

Reputation: 5929

Android: trigger an event in Activity onCreate

My app has 2 activities which have no way to reference eachother; what I would like is when Activity B is created, an event is triggered in Activity A (I'm trying to "finish()" Activity A)

Is there some kind of event handler that I can create in Activity A to listen for such a thing?

Upvotes: 0

Views: 934

Answers (1)

Kuffs
Kuffs

Reputation: 35661

Only one activity at a time can be active which makes it impossible for one activity to send a message directly to another in real time.

From your description, I think you need to use one Activity that hosts multiple fragments. The fragments can "chat" to each other as much as you like and both can be active at the same time.

Upvotes: 1

Related Questions