I get the following 3 errors in the ModelFragment.java:
The method doInBackGround(Context...) of type ModelFragment.PrefsLoadTask must override or implement a supertype method
The type ModelFragment.PrefsLoadTask must implement the inherited abstract method AsyncTask<Context,Void,Void>.doInBackground(Context...)
Void methods cannot return a value
Here is my sourcecode:
private class PrefsLoadTask extends AsyncTask<Context, Void, Void> {
SharedPreferences localPrefs=null;
@Override
protected void doInBackGround(Context... ctxt) {
localPrefs=PreferenceManager.getDefaultSharedPreferences(ctxt[0]);
localPrefs.getAll();
return(null);
}
@Override
public void onPostExecute(Void Arg0) {
ModelFragment.this.prefs=localPrefs;
ModelFragment.this.prefsTask=null;
deliverModel();
}
}
As far as i can see the code is just like in the book. Also i have gone through all code that i have entered in this chapter. Can you see any errors her? The apps run ok after step #5 in this chapter.
No, it is not. It is
doInBackground()
, notdoInBackGround()
(notice the case of theg
). Also, the return type must beVoid
, notvoid
(notice the case of theV
).