Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); String pluginName; if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); pluginName = getIntent().getStringExtra(KEY_PLUGIN_NAME); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); pluginName = savedInstanceState.getString(KEY_PLUGIN_NAME); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, Duration.SHORT); finish(); return; } mPlugin = mPluginStore.getSitePluginByName(mSite, pluginName); if (mPlugin == null) { ToastUtils.showToast(this, R.string.plugin_not_found, Duration.SHORT); finish(); return; } if (savedInstanceState == null) { mIsActive = mPlugin.isActive(); mIsAutoUpdateEnabled = mPlugin.isAutoUpdateEnabled(); } else { mIsConfiguringPlugin = savedInstanceState.getBoolean(KEY_IS_CONFIGURING_PLUGIN); mIsUpdatingPlugin = savedInstanceState.getBoolean(KEY_IS_UPDATING_PLUGIN); mIsRemovingPlugin = savedInstanceState.getBoolean(KEY_IS_REMOVING_PLUGIN); mIsActive = savedInstanceState.getBoolean(KEY_IS_ACTIVE); mIsAutoUpdateEnabled = savedInstanceState.getBoolean(KEY_IS_AUTO_UPDATE_ENABLED); } mPluginInfo = PluginUtils.getPluginInfo(mPluginStore, mPlugin); <START> mDispatcher.dispatch(PluginActionBuilder.newFetchPluginInfoAction(mPlugin.getSlug())); <END> setContentView(R.layout.plugin_detail_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(mPlugin.getDisplayName()); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); } setupViews(); if (mIsRemovingPlugin) { showRemovePluginProgressDialog(); } }</code><technical_language>I do this savedInstanceState == null (ie: activity is created). plugin info is updated time device is rotated, wasteful</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); String pluginName; if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); pluginName = getIntent().getStringExtra(KEY_PLUGIN_NAME); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); pluginName = savedInstanceState.getString(KEY_PLUGIN_NAME); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, Duration.SHORT); finish(); return; } mPlugin = mPluginStore.getSitePluginByName(mSite, pluginName); if (mPlugin == null) { ToastUtils.showToast(this, R.string.plugin_not_found, Duration.SHORT); finish(); return; } if (savedInstanceState == null) { mIsActive = mPlugin.isActive(); mIsAutoUpdateEnabled = mPlugin.isAutoUpdateEnabled(); mDispatcher.dispatch(PluginActionBuilder.newFetchPluginInfoAction(mPlugin.getSlug())); } else { mIsConfiguringPlugin = savedInstanceState.getBoolean(KEY_IS_CONFIGURING_PLUGIN); mIsUpdatingPlugin = savedInstanceState.getBoolean(KEY_IS_UPDATING_PLUGIN); mIsRemovingPlugin = savedInstanceState.getBoolean(KEY_IS_REMOVING_PLUGIN); mIsActive = savedInstanceState.getBoolean(KEY_IS_ACTIVE); mIsAutoUpdateEnabled = savedInstanceState.getBoolean(KEY_IS_AUTO_UPDATE_ENABLED); mIsShowingRemovePluginConfirmationDialog = savedInstanceState.getBoolean(KEY_IS_SHOWING_REMOVE_PLUGIN_CONFIRMATION_DIALOG); } mPluginInfo = PluginUtils.getPluginInfo(mPluginStore, mPlugin); setContentView(R.layout.plugin_detail_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(mPlugin.getDisplayName()); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); } setupViews(); if (mIsShowingRemovePluginConfirmationDialog) { confirmRemovePlugin(); } if (mIsRemovingPlugin) { showRemovePluginProgressDialog(); } }