My app crashes or goes back to home screen when someone click twice on settings in exo player, pressing it once shows " Please wait for the content to load " toast but pressing it twice crashes the app, although after the content is loaded the app doesn't crash, you can click on it as many times as you want. how do I solve it?
ImageView img_audio = findViewById(R.id.img_audio);
img_audio.setOnClickListener(view -> {
if (contentLoaded) {
MappingTrackSelector.MappedTrackInfo mappedTrackInfo;
DefaultTrackSelector.Parameters parameters = trackSelector.getParameters();
TrackSelectionDialog trackSelectionDialog =
TrackSelectionDialog.createForTrackSelector(
trackSelector,
/* onDismissListener= */ dismissedDialog -> {
});
trackSelectionDialog.show(getSupportFragmentManager(), null);
} else {
Toast.makeText(DetailsActivity.this, R.string.please_wait, Toast.LENGTH_LONG).show();
}
// Active playback.
contentLoaded = true;
});
