-1

I need to add a preference from an activity witch does not extend PreferenceActivity, i tried this:

PreferenceCategory targetCategory = (PreferenceCategory)findPreference("kurse");
                    EditTextPreference neuerKursEintrag = new EditTextPreference(SettingsActivity.this);
                    neuerKursEintrag.setKey("kurs");
                    targetCategory.addPreference(neuerKursEintrag);

but it does not work, because android studio cannot resolve the method findPreference(java.lang.String)

Simon
  • 1
  • 1

1 Answers1

0

Take a look at the docs. The method signature is not findPreference(String preferenceName), it's findPreference (CharSequence key)

Noy
  • 1,258
  • 2
  • 11
  • 28