Code example for DownloadManager.Query

Methods: setFilterById

0
    private int getDownloadFailureReason(long id) {
        return getDownloadQueryAsInt(id, DownloadManager.COLUMN_REASON);
    } 
 
    private int getDownloadQueryAsInt(long id, String column) {
        Query query = new Query();
        query.setFilterById(id);
 
        Cursor c = downloadManager.query(query);
        if (!c.moveToFirst()) {
            return -1; 
        } 
 
        int columnIndex = c.getColumnIndex(column);
        return c.getInt(columnIndex);
    } 
 
    public interface DownloadCallback { 
        void onStart(String path);
        void onCancel();