title: NullPointerException after starting an Activity (at android.content.ComponentName.<init>(ComponentName.java:78))
body: <p>I'm scratching my head on this one, not sure what to make of it. I received a report of a NullPointerException happening after I started the activity, but not all the time. Any ideas what might be happening?</p>
  
  <p>Here's the stack trace, as reported by Google. Note that onItemClick() called startIntent, and somewhere there is where the NullPointerException happened.</p>
  
  <pre><code>java.lang.NullPointerException
  at android.content.ComponentName.&lt;init&gt;(ComponentName.java:78)
  at android.content.Intent.&lt;init&gt;(Intent.java:4180)
  at com.kd7uiy.hamfinder.al.onItemClick(Unknown Source)
  at android.widget.AdapterView.performItemClick(AdapterView.java:308)
  at android.widget.AbsListView.performItemClick(AbsListView.java:1478)
  at android.widget.AbsListView$PerformClick.run(AbsListView.java:3480)
  at android.widget.AbsListView$3.run(AbsListView.java:4823)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:157)
  at android.app.ActivityThread.main(ActivityThread.java:5356)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>And here's the code.</p>
  
  <pre><code>public MainNavigationDrawerAdapter(Context context, FragmentManager fragMan,int locLogActivity) {
      mContext=context;
      mFragMan=fragMan;
      mTitle=context.getString(locLogActivity);
      mHashMap=new HashMap&lt;String,Class&lt;?&gt;&gt;();
      addToMap(R.string.upgrade_activity,ManageAddOnPurchaseActivity.class);
      addToMap(R.string.qth_map_activity,QthMapActivity.class);
      addToMap(R.string.export_to_adif,WriteADIF.class);
      mAdapter = new ArrayAdapter&lt;String&gt; (context,R.layout.drawer_list_item);
      for (String key:mHashMap.keySet()) {
          mAdapter.add(key);
      }
  }
  
  private void addToMap(int titleResource, Class&lt;?&gt; theClass) {
      String title=mContext.getString(titleResource);
      if (!mTitle.equals(title)) {
          mHashMap.put(title,theClass);
      }
  }
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int position, long id) {
      Intent intent=new Intent(mContext,mHashMap.get(((TextView)view).getText()));
      mContext.startActivity(intent);
  }
  </code></pre>