mediaplayer and dialog
<p>I've an "info" dialog and I'd like add background music. I added my music in res/raw, just open dialog there's a check by sharedpreferences (a boolean to check if audio already started) and 2 methods: musicStart() and musicStop()</p>

<p>so, before onCreate I added:</p>

<pre><code>MediaPlayer mp = MediaPlayer.create(this, R.raw.sob);
</code></pre>

<p>but app crash with:</p>

<p>12-06 18:54:14.425: E/AndroidRuntime(414): Caused by: java.lang.NullPointerException</p>

<p>I don't understand why</p>
