title: Android ExceptionInitializerError
body: <p>I'm getting an "ExceptionInitializerError" on the following line of code:</p>
  
  <p>(Activity 1) </p>
  
  <pre><code>Activity2.selection = AudioColumns.ARTIST + "=?";
  </code></pre>
  
  <p>(Activity 2)</p>
  
  <pre><code>static String selection;
  </code></pre>
  
  <p>Could someone please tell me what I'm doing wrong?</p>
  
  <p>For complete code, see below.</p>
  
  <p>(Activity 1)</p>
  
  <pre><code>package awesome.music.player;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.database.Cursor;
  import android.os.Bundle;
  import android.provider.BaseColumns;
  import android.provider.MediaStore;
  import android.provider.MediaStore.Audio.AlbumColumns;
  import android.provider.MediaStore.Audio.ArtistColumns;
  import android.provider.MediaStore.Audio.AudioColumns;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ListView;
  import android.widget.SimpleCursorAdapter;
  
  public class ArtistsActivity extends Activity implements OnItemClickListener {
  
      private Cursor artistCursor;
  
      @SuppressWarnings("deprecation")
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.artistsview);
  
          String[] artistColumns = { BaseColumns._ID, ArtistColumns.ARTIST };
          // The columns to return for each row.
  
          artistCursor = managedQuery(
                  MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, artistColumns,
                  null, null, null);
  
          ListView listView = (ListView) findViewById(R.id.listViewArtists);
          listView.setOnItemClickListener(this);
          // set an on item click listener to the first list view in this activity
  
          String[] displayFields = new String[] { ArtistColumns.ARTIST };
          // set all the artist names to the array "displayfields"
          int[] displayViews = new int[] { R.id.artistTitle };
          // number of rows to display and where to bind them
  
          SimpleCursorAdapter artistAdapter = new SimpleCursorAdapter(this,
                  R.layout.artistitem, artistCursor, displayFields, displayViews);
          listView.setAdapter(artistAdapter);
      }
  
      // Take the display fields array, and bind to the matching display row
  
      public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) {
          if (artistCursor.moveToPosition(position)) {
  
              Playlist.selection = AudioColumns.ARTIST + "=?";
  
              Playlist.selectionArgs = new String[] { artistCursor
                      .getString(artistCursor.getColumnIndex(AlbumColumns.ARTIST)) };
  
              Playlist.artist = artistCursor.getString(artistCursor
                      .getColumnIndex(ArtistColumns.ARTIST));
  
              Intent intent = new Intent(ArtistsActivity.this,
                      ArtistAlbumsActivity.class);
  
              startActivity(intent);
  
          }
      }
  
  }
  </code></pre>
  
  <p>(Activity 2)</p>
  
  <pre><code>package awesome.music.player;
  
  import java.util.ArrayList;
  
  import android.content.ContentUris;
  import android.net.Uri;
  
  public class Playlist {
  
      static ArrayList&lt;String&gt; pathList = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; artistList = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; albumList = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; titleList = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; idList = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; durationList = new ArrayList&lt;String&gt;();
  
      static int currentSongIndex;
      static String currentSongPath;
      static String artist;
      static String album;
      static String albumId;
      static String numSongs;
      static String selection;
      static String[] selectionArgs;
      static String totalSongduration; // Set
  
      static String songDuration = durationList.get(currentSongIndex);
  
      static String currentAlbumId = Playlist.idList
              .get(Playlist.currentSongIndex);
  
      static Integer currentAlbumIdLong = Integer.parseInt(currentAlbumId);
  
      static Uri artworkUri = Uri
              .parse("content://media/external/audio/albumart");
  
      static Uri currentSongUri = ContentUris.withAppendedId(artworkUri,
              currentAlbumIdLong);;
  
      static int totalSongDuration = Integer.parseInt(songDuration);
  
  }
  </code></pre>
  
  <p>Thanks for your help.</p>