title: Android: Null Pointer Exception when calling new intent
body: <p>I am receiving an error when trying to call new activity through an intent:</p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.ActivityThread$ApplicationThread android.app.ActivityThread.getApplicationThread()' on a null object reference
  </code></pre>
  
  <p>My Activity has a button, and when clicked, it goes to this method:</p>
  
  <pre><code>public void onClickChangeActivity() {
  
          Intent intent = new Intent(context , Details.class);
          startActivity(intent);
  
      }
  </code></pre>
  
  <p>public static Context context is created in the beginning of the class and then is instantiated in my onCreate as context = getApplicationContext();</p>
  
  <p>I've also tried context = getBaseContext() and context = RecyclerViewActivity.this (RecyclerViewActivity is the name of my current class)</p>
  
  <p>Any help as to why I'm receiving this NullP? I've tried everything related StackOverFlow answers have offered. Also, my Manifest includes my activity. </p>
  
  <p>onClickChangeActivity is being called from my RecyclerViewerAdapter class:</p>
  
  <pre><code>View.OnClickListener getPersonClickListener(final int position) {
          return new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
  
                  RecyclerViewActivity recyclerViewActivity = new RecyclerViewActivity();
                  recyclerViewActivity.onClickChangeActivity();
              }
          };
  </code></pre>
  
  <p>Manifest File:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.test.akash.android_test" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="16"
          android:targetSdkVersion="21" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission
          android:name="android.permission.WRITE_EXTERNAL_STORAGE"
          android:maxSdkVersion="18" /&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission
          android:name="android.permission.READ_EXTERNAL_STORAGE"
          android:maxSdkVersion="18" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;!-- &lt;activity --&gt;
          &lt;!-- android:name=".DataFetcher" --&gt;
          &lt;!-- android:label="@string/title_activity_data_fetcher" &gt; --&gt;
          &lt;!-- &lt;/activity&gt; --&gt;
          &lt;activity
              android:name=".Crime"
              android:label="@string/title_activity_crime"
              android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".RecyclerViewActivity"
              android:label="@string/title_activity_recycler_view"
              android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Details"
              android:label="@string/title_activity_crime_details"
              android:parentActivityName=".RecyclerViewActivity" &gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value="RecyclerViewActivity" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>LogCat:</p>
  
  <pre><code> java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
              at android.content.ContextWrapper.getPackageName(ContextWrapper.java:132)
              at android.content.ComponentName.&lt;init&gt;(ComponentName.java:77)
              at android.content.Intent.&lt;init&gt;(Intent.java:4160)
              at com.bah.baltimoreopendata.android_baltimoreopendata.RecyclerViewActivity.onClickChangeActivity(RecyclerViewActivity.java:265)
              at com.bah.baltimoreopendata.android_baltimoreopendata.RecycleViewAdapter$1.onClick(RecycleViewAdapter.java:121)
              at android.view.View.performClick(View.java:4780)
              at android.view.View$PerformClick.run(View.java:19866)
              at android.os.Handler.handleCallback(Handler.java:739)
              at android.os.Handler.dispatchMessage(Handler.java:95)
              at android.os.Looper.loop(Looper.java:135)
              at android.app.ActivityThread.main(ActivityThread.java:5254)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  </code></pre>