Unregister EventBus listener in onDestroy in TrendingActivity and RPANActivity.

This commit is contained in:
Alex Ning 2021-07-19 19:23:16 +08:00
parent 03f8741f3d
commit 037223e286
2 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import com.evernote.android.state.State;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.livefront.bridge.Bridge; import com.livefront.bridge.Bridge;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -350,6 +351,12 @@ public class RPANActivity extends AppCompatActivity {
return false; return false;
} }
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
private void shareLink(String link) { private void shareLink(String link) {
try { try {
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);

View File

@ -293,6 +293,12 @@ public class TrendingActivity extends BaseActivity {
outState.putParcelableArrayList(TRENDING_SEARCHES_STATE, trendingSearches); outState.putParcelableArrayList(TRENDING_SEARCHES_STATE, trendingSearches);
} }
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Override @Override
protected SharedPreferences getDefaultSharedPreferences() { protected SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences; return mSharedPreferences;