 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML5 <audio> tag not working in Android Webview
Use Mediaplayer of Android for playing audio. You need to call function of Android from JavaScript that you have written in HTML file.
WebView wv = (WebView) findViewById(R.id.webview); wv.addJavascriptInterface(new WebAppInterface(this), "Android"); public class WebAppInterface {    Context mContext;    WebAppInterface(Context c) {       mContext = c;    }    @JavascriptInterface    public void showToast(String toast) {       Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();    } } The following is my JavaScript:
<input type = "button" value = "Demo" onClick = "showAndroidToast('Hello Android!')" /> <script>    function showAndroidToast(toast) {       Android.showToast(toast);    } </script>Advertisements
 