diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index 93aa3e6e..2fb4030c 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -412,7 +412,12 @@ public class SettingsActivity extends SyncthingActivity { // User has clicked on a sub-preferences screen. try { mCurrentPrefScreenDialog = ((PreferenceScreen) preference).getDialog(); - LinearLayout root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent().getParent(); + LinearLayout root; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent().getParent(); + } else { + root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent(); + } SyncthingActivity syncthingActivity = (SyncthingActivity) getActivity(); LayoutInflater layoutInflater = syncthingActivity.getLayoutInflater(); Toolbar toolbar = (Toolbar) layoutInflater.inflate(R.layout.widget_toolbar, root, false);