Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Using Webview but no downloading
    text
    copied!<p>I am using webview to open a website inside android app, but when clicking on download files link its not starting download. how i do it ???</p> <p>The site is of music downlaod but when clicking on mp3 file link nothing happens.</p> <p>Code:</p> <pre><code>public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); // Let's display the progress in the activity title bar, like the // browser app does. getWindow().requestFeature(Window.FEATURE_PROGRESS); WebView webview = new WebView(this); setContentView(webview); webview.getSettings().setJavaScriptEnabled(true); final Activity activity = this; webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% activity.setProgress(progress * 1000); } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { //Users will be notified in case there's an error (i.e. no internet connection) Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show(); } }); //This will load the webpage that we want to see webview.loadUrl("http://www.xtramasti.com/"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } </code></pre>
 

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