Prevent crash

This commit is contained in:
M66B 2019-04-13 08:46:30 +02:00
parent f93eb61b04
commit 3b9bf64578
1 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.ScrollView;
import java.util.ArrayList;
import java.util.Arrays;
@ -137,8 +138,10 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
protected View getVisibleView() {
for (Fragment fragment : getSupportFragmentManager().getFragments())
if (fragment.getUserVisibleHint()) {
Log.i("Visible fragment=" + fragment.getClass().getName());
return fragment.getView();
View view = fragment.getView();
Log.i("Visible fragment=" + fragment.getClass().getName() + " view=" + view);
if (view != null && !(view instanceof ScrollView)) // Snackbar cannot be attached to ScrollView
return view;
}
Log.i("Visible activity=" + this.getClass().getName());