Android SharedPreferences in Fragment

Próbuję odczytać SharedPreferences wewnątrz Fragmentu. Mój kod jest tym, czego używam, aby uzyskać preferencje w innych działaniach.

     SharedPreferences preferences = getSharedPreferences("pref", 0);

Dostaję błąd

    Cannot make a static reference to the non-static method getSharedPreferences(String, int) from the type ContextWrapper    

Próbowałem śledzić te linki, ale bez powodzeniaDostęp do SharedPreferences za pomocą metod statycznych iStatyczne udostępnione preferencje. Dziękujemy za każde rozwiązanie.

questionAnswers(6)

yourAnswerToTheQuestion