title: Android Runtime and Nullpoint Exceptions
body: <p>I have Parse initialization in a class named (ParseInitialization.java) that extends Application and while running my application (MainActivity.java) I got a RuntimeException
  and whene I call Parse.initialize inside onCreate in (MainActivity.java) I got a NullpointException</p>
  
  <p>here is my code:</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.baharat2;
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.view.Menu;
  import android.view.MenuInflater;
  import com.parse.ParseAnonymousUtils;
  import com.parse.ParseUser;
  
  public class MainActivity extends Activity {
  private Button signin_btn ;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  signin_btn = (Button) findViewById(R.id.button1);
  signin_btn.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
  
          // TODO Auto-generated method stub      
          // Determine whether the current user is an anonymous user
          if (ParseAnonymousUtils.isLinked(ParseUser.getCurrentUser())) {
              // If user is anonymous, send the user to LoginSignupActivity.class
              Intent intent = new Intent(MainActivity.this,LoginSignupActivity.class);
              startActivity(intent);
              finish();
          } else {
          // If current user is NOT anonymous user
          // Get current user data from Parse.com
          ParseUser currentUser = ParseUser.getCurrentUser();
          if (currentUser != null) {
              // Send logged in users to Welcome.class
              Intent intent = new Intent(MainActivity.this, Welcome.class);
              startActivity(intent);
              finish();
          } else {
              // Send user to LoginSignupActivity.class
              Intent intent = new Intent(MainActivity.this,LoginSignupActivity.class);
              startActivity(intent);
              finish();
      }
    }
   } 
   });
  }
  
   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.main, menu);
   return super.onCreateOptionsMenu(menu);
   }
  }
  </code></pre>
  
  <p>ParseInitialization.java</p>
  
  <pre><code>package com.example.baharat2;
  import android.app.Application;
  import com.parse.Parse;
  import com.parse.ParseACL;
  import com.parse.ParseObject;
  import com.parse.ParseUser;
  
  public class ParseInitialization extends Application {
  @Override
  public void onCreate() {
      super.onCreate();
  
      // Add your initialization code here
      Parse.initialize(this, "xxx", "xxx");
  
  
      ParseUser.enableAutomaticUser();
      ParseACL defaultACL = new ParseACL();
  
      // If you would like all objects to be private by default, remove this line.
      defaultACL.setPublicReadAccess(true);
  
      ParseACL.setDefaultACL(defaultACL, true);
  
      ParseObject testObject = new ParseObject("TestObject");
      testObject.put("foo", "bar");
      testObject.saveInBackground();
    }
  }
  </code></pre>
  
  <p>Logcat</p>
  
  <pre><code>03-21 11:05:56.133: E/AndroidRuntime(2348): FATAL EXCEPTION: main
  03-21 11:05:56.133: E/AndroidRuntime(2348): Process: com.example.baharat2, PID: 2348
  03-21 11:05:56.133: E/AndroidRuntime(2348): java.lang.RuntimeException: You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at com.parse.ParseUser.checkApplicationContext(ParseUser.java:941)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at com.parse.ParseUser.getCurrentUser(ParseUser.java:813)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at com.example.baharat2.MainActivity$1.onClick(MainActivity.java:30)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.view.View.performClick(View.java:4438)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.view.View$PerformClick.run(View.java:18422)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.os.Handler.handleCallback(Handler.java:733)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.os.Handler.dispatchMessage(Handler.java:95)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.os.Looper.loop(Looper.java:136)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at java.lang.reflect.Method.invoke(Method.java:515)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  03-21 11:05:56.133: E/AndroidRuntime(2348):     at dalvik.system.NativeStart.main(Native Method)
  03-21 11:06:01.753: I/Process(2348): Sending signal. PID: 2348 SIG: 9
  </code></pre>
  
  <p>Also I have this (ParseInitialization) activity in Manifest</p>
  
  <pre><code> &lt;activity
   android:name="ParseInitialization"&gt;
   &lt;/activity&gt;
  </code></pre>
  
  <p>Any suggestions ?</p>