English | Site Directory

Android - An Open Handset Alliance Project

android.webkit
public interface

android.webkit.DownloadListener

android.webkit.DownloadListener

Summary

Constants

      Value  
int  DOWNLOAD_FAILED_CANT_OPEN_FILE    0x00000003 
int  DOWNLOAD_FAILED_CANT_WRITE    0x00000004 
int  DOWNLOAD_FAILED_NO_HANDLING_APP    0x00000002 
int  DOWNLOAD_FAILED_NO_SDCARD  These flags are used with the function onDownloadFailed() to indicate the reason for the file download failure.  0x00000001 

Public Methods

        void  onDownloadFailed(String filename, int reasonCode)
Notify the host application that a content download attempt has been requested, but failed.
        void  onDownloadFinished(String filename)
Notify the host application that a download has been completed.
        void  onDownloadStart(String filename, String mimetype, long contentLength, Message suspendMsg, Message cancelMsg)
Notify the host application that a download has started.
        void  onDownloadSuspended(String filename, Message resumeMsg)
Notify the host application that a download has been suspended.

Details

Constants

public static final int DOWNLOAD_FAILED_CANT_OPEN_FILE

Constant Value: 3 (0x00000003)

public static final int DOWNLOAD_FAILED_CANT_WRITE

Constant Value: 4 (0x00000004)

public static final int DOWNLOAD_FAILED_NO_HANDLING_APP

Constant Value: 2 (0x00000002)

public static final int DOWNLOAD_FAILED_NO_SDCARD

These flags are used with the function onDownloadFailed() to indicate the reason for the file download failure. DOWNLOAD_FAILED_NO_SDCARD indicates that an SDCard is not present. A storage card is required to download content. DOWNLOAD_FAILED_NO_HANDLING_APP indicates that there is no application found that can handle the content that the user has selected to download, only supported content can be downloaded. DOWNLOAD_FAILED_CANT_OPEN_FILE indicates that the download file could not be opened. This could be due to permissions, or the sdcard is write protected. DOWNLOAD_FAILED_CANT_WRITE indicates that the downloaded contents could not be written to sdcard. This could be due to sdcard being full or bad sectors on the sdcard.
Constant Value: 1 (0x00000001)

Public Methods

public void onDownloadFailed(String filename, int reasonCode)

Notify the host application that a content download attempt has been requested, but failed. Failure reason is passed as a parameter.

Parameters

filename The full path to the file that is being downloaded or null if the file was not downloaded.
reasonCode One of the DOWNLOAD_FAILED_x flags.

public void onDownloadFinished(String filename)

Notify the host application that a download has been completed.

Parameters

filename The full path of the file that was downloaded

public void onDownloadStart(String filename, String mimetype, long contentLength, Message suspendMsg, Message cancelMsg)

Notify the host application that a download has started.

Parameters

filename The full path to the file that is being downloaded
mimetype The mimetype of the content reported by the server
contentLength The file size reported by the server
suspendMsg The message to use to suspend this download
cancelMsg The message to use to cancel this download

public void onDownloadSuspended(String filename, Message resumeMsg)

Notify the host application that a download has been suspended. This is usually because the download was interrupted due to a phone call or loss of network coverage.

Parameters

filename The full path of the file that is being downloaded
resumeMsg The message to use to resume the download.
Build m5-rc15i - 10 Jun 2008 13:54