title: android studio ,playing custom ringtone crashes?
body: <p>When playing ring tone in my app using media player class, it crashes. When I select a song as a ring tone, with default ring tones it works fine, and when playing ring tone using ring tone and audio manager class, it won't crash, but I am unable to loop the ring tone.</p>
  
  <pre><code>Uri audio = RingtoneManager.getActualDefaultRingtoneUri(getApplicationContext(),RingtoneManager.TYPE_RINGTONE); 
  mp = MediaPlayer.create(getApplicationContext(), audio); 
  </code></pre>
  
  <p>Log cat error:</p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
  </code></pre>