Во-первых, его там нет (как быть?). Ладно, делаю паблик запрос через сервис1.
И компилер ругается
java: non-static method getContext() cannot be referenced from a static context
что я делаю не так?
вот код обоих:
Код: Выделить всё
public class сервис1 extends Service {
...
public Context getContext() {
return getApplicationContext();
}
--------------------------------
public class класс1 {
...
void работа(){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(сервис1.getContext());
java: non-static method getApplicationContext() cannot be referenced from a static context
