title: Content function from Extra.class android
body: <p>I am implementing a function that call an intent from my Extra.class. Instead of doing inter = new intent(this, class); several time i want a custom one as shown below. but this produce an error log when i call for example Extra.toClass(context, Act.class);</p>
  
  <p>import android.content.Context;
      import android.content.Intent;</p>
  
  <pre><code>public class Extra extends Activity {
  
      private static Context context;
      private static Class&lt;?&gt; activity;
      private static Intent intx;
  
      public static void toClass(Context text,Class&lt;?&gt; a){
  
          text = context;
          a = activity;
  
          intx = new Intent(text,a);
          context.startActivity(intx);
  
      }
  }
  </code></pre>
  
  <p>this is my log</p>
  
  <pre><code>05-31 09:56:26.128: E/AndroidRuntime(1545): FATAL EXCEPTION: main
  05-31 09:56:26.128: E/AndroidRuntime(1545): java.lang.RuntimeException: Unable to start activity ComponentInfo{.app/.app.CompteCompagnon}: java.lang.NullPointerException
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.os.Handler.dispatchMessage(Handler.java:99)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.os.Looper.loop(Looper.java:130)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread.main(ActivityThread.java:3687)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at java.lang.reflect.Method.invokeNative(Native Method)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at java.lang.reflect.Method.invoke(Method.java:507)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at dalvik.system.NativeStart.main(Native Method)
  05-31 09:56:26.128: E/AndroidRuntime(1545): Caused by: java.lang.NullPointerException
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.content.ComponentName.&lt;init&gt;(ComponentName.java:75)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.content.Intent.&lt;init&gt;(Intent.java:2863)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at .app.util.extra.Extra.toClass(Extra.java:18)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at .app.CompteCompagnon.onCreate(CompteCompagnon.java:44)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
  05-31 09:56:26.128: E/AndroidRuntime(1545):     ... 11 more
  05-31 09:56:26.132: E/(136): Dumpstate &gt; /data/log/dumpstate_app_error
  05-31 09:56:32.742: E/(279): onResume() check 0
  05-31 09:56:32.742: E/(279): onResume() check 1
  05-31 09:56:32.742: E/Launcher(279): setWindowOpaque()
  05-31 09:56:32.796: E/(279): onResume() check 2, mRestoring : false
  05-31 09:56:32.800: E/(279): onResume() check 3
  05-31 09:56:32.800: E/(279): onResume() check 4
  05-31 09:56:32.800: E/(279): onResume() check 5
  </code></pre>