S
S
Stanislav Korolevskiy2017-11-11 16:41:24
Java
Stanislav Korolevskiy, 2017-11-11 16:41:24

Can't access Context?

Any call to Context returns null.

public Context context;

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);

All this returns null. I'm trying to get access from the activity

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-11-11
@korolevsky_s

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);//if in activity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question