Fix bug #15086008 NPE observed after user setup device daydream followed by device orientation
- get the Switch reference when the fragment activity has been created and thus into onActivityCreated(Bundle) Change-Id: I16c8e42ff225db029d017c392f4273a1fe277a21
This commit is contained in:
@@ -82,17 +82,11 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
||||
logd("onCreate(%s)", icicle);
|
||||
super.onCreate(icicle);
|
||||
|
||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||
|
||||
mBackend = new DreamBackend(activity);
|
||||
|
||||
mSwitchBar = activity.getSwitchBar();
|
||||
mSwitch = mSwitchBar.getSwitch();
|
||||
mBackend = new DreamBackend(getActivity());
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||
if (!mRefreshing) {
|
||||
@@ -127,6 +121,10 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
mAdapter = new DreamInfoAdapter(mContext);
|
||||
listView.setAdapter(mAdapter);
|
||||
|
||||
final SettingsActivity sa = (SettingsActivity) getActivity();
|
||||
mSwitchBar = sa.getSwitchBar();
|
||||
mSwitch = mSwitchBar.getSwitch();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user