Changing background across all activities with sharedpreferences

45 Views Asked by At

I have an Activity where i store the drawable in SharedPreferences and then load it in the onResume() method in the other activities to change the background.

Like this:

@Override
 protected void onResume() {
    super.onResume(); 

    int mSavedBackground = storageUtil.loadBackgroundId();

    mMainLayout.setBackgroundResource(mSavedBackground);
}

But is it bad to always call .setBackgroundResource in onResume()?

0

There are 0 best solutions below