How should DownloadListener work? I guess I missed something. I have done the following:
- Register DownloadListener in WebView.
- Open a WebView with an HTML page containing a link (works).
- If I click on the link, DownloadListener is not called.
Here is a short piece of code.
package rene.android.learnit; import android.app.*; import android.os.Bundle; import android.webkit.*; public class ShowWeb extends Activity implements DownloadListener { public static Lesson L; WebView WV; @Override public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.showweb); WV=(WebView)findViewById(R.id.showweb); WV.setDownloadListener(this); WV.loadUrl("http://android.rene-grothmann.de/courses.html"); } public void onDownloadStart (String url, String agent, String disposition, String mimetype, long size) { Main.log(url+" "+mimetype+" "+size); } }
Logging work (I use this everywhere to test my program), but nothing is logged, so the callback is not called. What happens: The view tries to download the file and does not work, since zip files are not supported on my Android.
The link goes to the zip file. It's ordinary
<a href=...>...</a>
link.
I tried to figure out an alternative intent registration method for zip files. But the documentation is so scarce that I could not do it. If I must, is there an example?
Any ideas?
Thanks R.
Reene source share