title: How to initialize the parse.com code in Android
body: <p>I am trying to use the Parse.com sdk and I can't get my Parse codes to initialize. I don't know where to put it and I need help because I can't tell if I need to put it in my main or if I need to put it in somewhere else. </p>
  
  <p><strong>This is a few blocks of code I have put in different classes</strong></p>
  
  <p><strong>I created this with the sample</strong></p>
  
  <pre><code>package com.example.musicdroid;
  import com.parse.Parse;
  import com.parse.ParseACL; 
  import com.parse.ParseUser;
  import android.app.Application;
  
  public class ParseApplication extends Application {
  
  @Override
  public void onCreate() {
      super.onCreate();
  
      // Add your initialization code here
      Parse.initialize(this, "XXX", "XXX");
  
      ParseUser.enableAutomaticUser();
      ParseACL defaultACL = new ParseACL();
  
  
      ParseACL.setDefaultACL(defaultACL, true);
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>This is where I had it originally</strong></p>
  
  <pre><code>import com.parse.Parse;
  import com.parse.ParseAnalytics;
  import com.parse.ParseInstallation;
  import com.parse.PushService;
  
  import android.net.Uri;
  import android.os.Bundle;
  import android.app.Activity;
  import android.app.ListActivity;
  import android.content.ActivityNotFoundException;
  import android.content.Intent;
  import android.view.Menu;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class Main extends ListActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      String[] choices = { "Rock", "Metal", "Rap", "My Favorites" };
      setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.main,
              R.id.music, choices));
  }
  
  protected void onListItemClick(ListView l, View v, int position, long id) {
      switch (position) {
      case 0:
          try {
              startActivity(new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("spotify:user:warnermusicus:playlist:3DRD3GUpQSjK2rryIRVOPS")));
          } catch (ActivityNotFoundException e) {
              final Intent intent = new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("https://play.google.com/store/apps/details?id=com.spotify.mobile.android.ui"));
              startActivity(intent);
          }
          break;
      case 1:
          try {
              startActivity(new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("spotify:user:warnermusicus:playlist:6iIDHF5tBqzS6uZjMEzBdQ")));
          } catch (ActivityNotFoundException e) {
              final Intent intent = new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("https://play.google.com/store/apps/details?id=com.spotify.mobile.android.ui"));
              startActivity(intent);
          }
          break;
      case 2:
          try {
              startActivity(new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("spotify:user:digsterdeutschland:playlist:5pvJLjAhcKCHXGOb7pEbBZ")));
          } catch (ActivityNotFoundException e) {
              final Intent intent = new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("https://play.google.com/store/apps/details?id=com.spotify.mobile.android.ui"));
              startActivity(intent);
          }
          break;
      case 3:
          try {
              startActivity(new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("spotify:user:digsterdeutschland:playlist:1hYWCuFv5Eav9yIZXHwnpd")));
          } catch (ActivityNotFoundException e) {
              final Intent intent = new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("https://play.google.com/store/apps/details?id=com.spotify.mobile.android.ui"));
              startActivity(intent);
          }
          break;
      }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Another place I had it. This is the Main Menu</strong> </p>
  
  <pre><code>package com.example.musicdroid;
  import com.parse.Parse;
  import com.parse.ParseAnalytics;
  import android.app.ListActivity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
   public class MainMenu extends ListActivity {
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      String[] choices = { "Main", "Bios", "Artist Search", "How To Use" };
      setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.menu, R.id.Menu,
              choices));
  }
  
  protected void onListItemClick(ListView l, View v, int position, long id) {
      switch (position) {
      case 0:
          startActivity(new Intent(MainMenu.this, Main.class));
          break;
      case 1:
          startActivity(new Intent(MainMenu.this, Bios.class));
          break;
      case 2:
          startActivity(new Intent(MainMenu.this, Search.class));
          break;
      case 3:
          startActivity(new Intent(MainMenu.this, How.class));
          break;
      }
  }
  }
  </code></pre>
  
  <p><strong>Manifest Code</strong></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.example.musicdroid"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  
  &lt;permission
      android:name="com.example.musicdroid.permission.C2D_MESSAGE"
      android:protectionLevel="signature" /&gt;
  
  &lt;uses-permission android:name="com.example.musicdroid.permission.C2D_MESSAGE" /&gt;
  
  &lt;uses-sdk
      android:minSdkVersion="8"
      android:targetSdkVersion="17" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@drawable/fiery_music_symbol"
      android:label="@string/app_name"
      android:theme="@android:style/Theme.Holo" &gt;
      &lt;activity
          android:name="com.example.musicdroid.Main"
          android:label="@string/app_name" &gt;
      &lt;/activity&gt;
      &lt;activity android:name=".MainMenu" &gt;
      &lt;/activity&gt;
      &lt;activity android:name=".Bios" &gt;
      &lt;/activity&gt;
      &lt;activity android:name=".Search" &gt;
      &lt;/activity&gt;
      &lt;activity android:name=".How" &gt;
      &lt;/activity&gt;
      &lt;activity android:name=".LoginSignupActivity" &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;activity android:name=".Welcome" &gt;
      &lt;/activity&gt;
  
      &lt;service android:name="com.parse.PushService" /&gt;
  
      &lt;receiver android:name="com.parse.ParseBroadcastReceiver" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
              &lt;action android:name="android.intent.action.USER_PRESENT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;receiver
          android:name="com.parse.GcmBroadcastReceiver"
          android:permission="com.google.android.c2dm.permission.SEND" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
              &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
              &lt;category android:name="com.example.musicdroid" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>