title: Android start Activity From Fragment Crash
body: <p>I am trying this code to start a activity from a Fragment by adding this code but the app crashes here</p>
  
  <pre><code>Intent i = new Intent(getActivity(), IsActive.class);
  startActivity(i);
  getActivity().finish();
  </code></pre>
  
  <p>this is my error log :</p>
  
  <pre><code>FATAL EXCEPTION: main                                                                        Process: media.aer.influencer, PID: 16165
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
    at android.content.ComponentName.&lt;init&gt;(ComponentName.java:128)
    at android.content.Intent.&lt;init&gt;(Intent.java:4459)
    at media.aer.influencer.Activity.MarkAsActiveFragment$10.onResponse(MarkAsActiveFragment.java:396)
    at media.aer.influencer.Activity.MarkAsActiveFragment$10.onResponse(MarkAsActiveFragment.java:333)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:67)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
    at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
    at android.os.Handler.handleCallback(Handler.java:746)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5443)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  </code></pre>
  
  <p>What am I doing wrong ??</p>