In my application i have 2 activity
.Activity
A and Activity
B.
For show Activity
B users should go to from Activity
A.
In activity
B i have one button
and i want when click on this button
finish
Activity B and call one method into Activity A.
For this work i write below code :
baseDialog_positiveBtn.setOnClickListener(v -> {
EventBus.getDefault().postSticky(new BuyPremiumUserEvent(true));
finish();
});
And for call method into Activity
A i write below code :
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onBuyPremium(final BuyPremiumUserEvent event) {
clickedOnBuyPremium = event.isClickOnBuyPremium();
Log.e("clickedOnBuyPremium", "Event : " + clickedOnBuyPremium);
if (AppConstant.getInstance().isPackageInstalled(AppConstant.BAZAAR_PAYMENT_PACKAGE, packageManager)) {
initBazaarUserRegistered();
} else {
AppConstant.getInstance().showMessage(activity, getString(R.string.errorTitle),
getString(R.string.notInstalledBazaar), R.color.catRedColor);
}
}
When click on Button
, call above method!
But when click on Button
, call Activity A methods always!
My mean is : after click on button
, even go to Activity
C , E and more ... and when click on back button
for go to Activity
A again call above method of Activity
A.
I want call above method just when click on button
from Activity
B, not always!
How can i fix it?