Note that there are some explanatory texts on larger screens.

plurals
  1. POthe application stopped unexpectedly when play sound
    primarykey
    data
    text
    <blockquote> <p>I created new <strong>Android</strong> App as it display static information , i had created <strong>html5</strong> and i call html5 files to my webview one of my html files function is play <strong>mp3</strong> when click on button I did my interface between html and android but when I test the project at device i had this message <strong>the application stopped unexpectedly</strong> . i had this project from tutorial this tutorial haven't extends Activity but when i removed it extends Activity <strong>error</strong> occurred " The method create(Context, int) in the type MediaPlayer is not applicable for the arguments (WebAppInterface, int) " .</p> </blockquote> <p></p> <pre><code>public class WebAppInterface extends Activity { Context mContext; MediaPlayer mp; WebAppInterface(Context c) { mContext = c; } @JavascriptInterface public void playsound() { mp=MediaPlayer.create(WebAppInterface.this, R.raw.sound); } </code></pre> <p>}</p> <p></p> <pre><code> &lt;input type="button" value="play mp3" onClick="playmp3()" /&gt; &lt;script type="text/javascript"&gt; function playmp3() { Android.playsound(); } &lt;/script&gt; </code></pre> <p></p> <blockquote> <p>06-23 15:46:20.250: E/AndroidRuntime(338): FATAL EXCEPTION: WebViewCoreThread 06-23 15:46:20.250: E/AndroidRuntime(338): java.lang.NullPointerException 06-23 15:46:20.250: E/AndroidRuntime(338): at android.content.ContextWrapper.getResources(ContextWrapper.java:80) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.media.MediaPlayer.create(MediaPlayer.java:641) 06-23 15:46:20.250: E/AndroidRuntime(338): at com.ramadan.WebAppInterface.showToast(WebAppInterface.java:23) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.webkit.WebViewCore.nativeTouchUp(Native Method) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.webkit.WebViewCore.nativeTouchUp(Native Method) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.webkit.WebViewCore.access$3300(WebViewCore.java:52) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1150) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.os.Handler.dispatchMessage(Handler.java:99) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.os.Looper.loop(Looper.java:123) 06-23 15:46:20.250: E/AndroidRuntime(338): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:621) 06-23 15:46:20.250: E/AndroidRuntime(338): at java.lang.Thread.run(Thread.java:1096)</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload