title: update shared preferences from AsyncTask onPostExecute
body: <p>AsyncTask onPostExecute crashes (reports nullpointerexecption) when I try to use the value I received from doInBackground to update SharedPreferences.</p>
  
  <p>My handle to the calling activity is: <code>private DashboardActivity&lt;?&gt; callerActivity;</code> with out the <code>&lt;?&gt;</code> it complains.  I've trie a couple of ways: 1) update SP in onPostExecute as:</p>
  
  <pre><code>SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(callerActivity);
  prefs.edit().putInt("lastrecord", intRec ).commit();
  </code></pre>
  
  <p>I've also called a method in the callerActivity as:</p>
  
  <pre><code>callerActivity.storeLastInsertedRecord(intRec);
  </code></pre>
  
  <p>All the errors are the same, nullpointerexection on these lines.</p>
  
  <p>What might I be doing wrong?  This answer <a href="https://stackoverflow.com/questions/12604414/android-shared-preferences-set-in-an-asynctask-onpostexecute-not-always-set">Android - shared preferences set in an AsyncTask onPostExecute() not always set?</a> by @denisdrew is the closest, but for it crashes at the same place when I try instantiate the intent: </p>
  
  <pre><code>Intent myIntent = new Intent(callerActivity.getApplicationContext(), SharedPrefsHelperActivity.class);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Intent myIntent = new Intent(callerActivity.getBaseContext(), SharedPrefsHelperActivity.class);
  </code></pre>
  
  <p>what might I be doing wrong?  I know that the value that I'm trying to push is not null (intRec).</p>