I am creating a webview app, use to download .mp3 files into mobile phone using url link within the webview. Im a newbie in this arena. Many example ive seen, yet i dint understand because its a bit different from my current code. i got confused. So based on the code given..what code do i need to input so user can click on the url link within the webview to download any files especially .mp3 files into the internal or external memory?
(activitymain.xml)
<WebView android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
(AndroidManifest.xml)
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
(MainActivity.java)
webview = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webview.setWebViewClient(new WebViewClient());
webview.loadUrl("WEBLINK");