I am writing an android application for my school project but i am stuck here. The problem is i have to access a SharedPreferences value and need it in an
Override onPreExecute or onPostExecute method of AsyncTask and get SharedPreferences there:
@Override
protected void onPreExecute() {
super.onPreExecute();
//get sharedPreferences here
SharedPreferences sharedPreferences = getSharedPreferences(, );
}
Please note that getSharedPreferences is an Activity method. So, you need to call it through Context if you are not using it in Activity.