Source:
public void onCreate(Bundle icicle) { super.onCreate(icicle); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); return; } addPreferencesFromResource(R.xml.unread_widget_configuration); unreadAccount = findPreference(PREFERENCE_UNREAD_ACCOUNT); unreadAccount.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(UnreadWidgetConfiguration.this, ChooseAccount.class); startActivityForResult(intent, REQUEST_CHOOSE_ACCOUNT); return false; } }); unreadFolderEnabled = (CheckBoxPreference) findPreference(PREFERENCE_UNREAD_FOLDER_ENABLED); unreadFolderEnabled.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { unreadFolder.setSummary(getString(R.string.unread_widget_folder_summary)); selectedFolderName = null; return true; } }); unreadFolder = findPreference(PREFERENCE_UNREAD_FOLDER); unreadFolder.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(UnreadWidgetConfiguration.this, ChooseFolder.class); intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, selectedAccountUuid); intent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes"); startActivityForResult(intent, REQUEST_CHOOSE_FOLDER); return false; } }); setTitle(R.string.unread_widget_select_account); }

Target:
public void onCreate(Bundle icicle) { super.onCreate(icicle); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { Timber.e("Received an invalid widget ID"); finish(); return; } addPreferencesFromResource(R.xml.unread_widget_configuration); unreadAccount = findPreference(PREFERENCE_UNREAD_ACCOUNT); unreadAccount.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(UnreadWidgetConfiguration.this, ChooseAccount.class); startActivityForResult(intent, REQUEST_CHOOSE_ACCOUNT); return false; } }); unreadFolderEnabled = (CheckBoxPreference) findPreference(PREFERENCE_UNREAD_FOLDER_ENABLED); unreadFolderEnabled.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { unreadFolder.setSummary(getString(R.string.unread_widget_folder_summary)); selectedFolderName = null; return true; } }); unreadFolder = findPreference(PREFERENCE_UNREAD_FOLDER); unreadFolder.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(UnreadWidgetConfiguration.this, ChooseFolder.class); intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, selectedAccountUuid); intent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes"); startActivityForResult(intent, REQUEST_CHOOSE_FOLDER); return false; } }); setTitle(R.string.unread_widget_select_account); }