public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { if (requestCode == ShortcutPickerHelper.REQUEST_PICK_SHORTCUT || requestCode == ShortcutPickerHelper.REQUEST_PICK_APPLICATION || requestCode == ShortcutPickerHelper.REQUEST_CREATE_SHORTCUT) { mPicker.onActivityResult(requestCode, resultCode, data); } } super.onActivityResult(requestCode, resultCode, data); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.title_spen); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.prefs_spen); PreferenceScreen prefs = getPreferenceScreen(); mPicker = new ShortcutPickerHelper(this, this); mEnableSPen = (CheckBoxPreference) findPreference("enable_spen"); mEnableSPen.setChecked( Settings.System.getBoolean( getContentResolver(), Settings.System.ENABLE_SPEN_ACTIONS, false)); mLeft = (ListPreference) findPreference("spen_left"); mLeft.setOnPreferenceChangeListener(this); mLeft.setSummary(getProperSummary(mLeft)); mRight = (ListPreference) findPreference("spen_right"); mRight.setOnPreferenceChangeListener(this); mRight.setSummary(getProperSummary(mRight)); mUp = (ListPreference) findPreference("spen_up"); mUp.setOnPreferenceChangeListener(this); mUp.setSummary(getProperSummary(mUp)); mDown = (ListPreference) findPreference("spen_down"); mDown.setOnPreferenceChangeListener(this); mDown.setSummary(getProperSummary(mDown)); mDouble = (ListPreference) findPreference("spen_double"); mDouble.setOnPreferenceChangeListener(this); mDouble.setSummary(getProperSummary(mDouble)); mLong = (ListPreference) findPreference("spen_long"); mLong.setOnPreferenceChangeListener(this); mLong.setSummary(getProperSummary(mLong)); }