title: How to check if getResources is null without getting ResourcesNotFound
body: <p>I have a number of sounds organized in levels, level1explicacio2, level2explicacio8, etc. Sometimes this sound will exist sometimes not. So I need to check if for example level5explicacio3 exist, and if it does, play some animation. So I made a if check if levelSoundPlayer is null, but of course, it doesn't compile because it cannot find a resource for levelSoundPlayer. How can I sort this out?</p>
  
  <pre><code>        levelSound = "level" + sharedPreferences.getString("Level","1") + "explicacio" + Integer.toString(1);
  
  
      Log.i("aviam", levelSound);
      levelSoundPlayer = MediaPlayer.create(this, getResources().getIdentifier(levelSound, "raw", getPackageName()));
      imageView = findViewById(R.id.imageView);
      imageViewReplace = findViewById(R.id.imageViewReplace);
  
      if (levelSoundPlayer!=null){
          Animation a = new AlphaAnimation(1.00f, 0.00f);
          a.setRepeatMode(Animation.REVERSE);
          a.setRepeatCount(Animation.INFINITE);
          a.setDuration(1000);
          imageViewReplace.startAnimation(a);
      }
  </code></pre>