title: How to check if resource pointed by Uri is available?
body: <p>I have resource (music file) pointed by Uri. How can I check if it is available before I try to play it with MediaPlayer?</p>
  
  <p>Its Uri is stored in database, so when the file is deleted or on external storage that is unmounted, then I just get exception when I call MediaPlayer.prepare(). </p>
  
  <p>In above situation I would like to play systems default ringtone. I could of course do that after I catch above exception, but maybe there is some more elegant solution?</p>
  
  <p>edit:
  I forgot to mention that music files Uri's are actually acquired by using RingtonePreference. This means that I can get Uri pointing to ringtone on Internal Storage, External Storage or to default systems ringtone.</p>
  
  <p>Uri's examples are:</p>
  
  <ul>
  <li>content://settings/system/ringtone - for choosing default ringtone</li>
  <li>content://media/internal/audio/media/60 - for ringtone on Internal Storage</li>
  <li>content://media/external/audio/media/192 - for ringtone on External Storage</li>
  </ul>
  
  <p>I was happy with proposed "new File(path).exists() method, as it saved me from mentioned exception, but after some time I noticed that it returns false for all of my ringtone choices...
  Any other ideas?</p>