0

I have two activity first is MainActity(FirstActivity) that just show data, second is BottomNavigationView Activity(SecondActivitys).

When I go to Some activity of SecondActivitys I want to send data back to FirstActity.

I have use Intent but on MainActivity have only one button that starts some of SecondActivitys. That means I have to call startActivity without requestCode the I cant use onActivityResult on MainActivity

how can I solve it? pls, help thx!!

Kilo
  • 21
  • 2

1 Answers1

0

I don't understand, Why you can't use onActivityResult?

But here is the alternative: You can try BroadcastReceiver or EventBus. Actually EventBus is a library which is using BroadcastReceivers. You can look there: Android-Broadcast Receiver

Note: Don't use Broadcast Receivers everywhere please. Because they are reducing the readability of the Code.

b.erdi
  • 386
  • 3
  • 12
  • Because on MainActivity I have one button when the user clicked. It goes to one of tab in bottonNavigationView activity the user can change the tab to input data. When I override onActivityResult I don't know what request code to use. Do u have private contact that we can talk? I'm stalled. – Kilo Oct 19 '20 at 18:08
  • https://stackoverflow.com/questions/64456340/sqlite-order-separate-date-and-time-column can u help this? – Kilo Oct 21 '20 at 03:40