Code example for DownloadManager.Query

Methods: setFilterById

0
        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
            if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { 
                long downloadId = intent.getLongExtra( 
                        DownloadManager.EXTRA_DOWNLOAD_ID, 0); 
                Query query = new Query(); 
                query.setFilterById(enqueue); 
                Cursor c = dm.query(query); 
                if (c.moveToFirst()) { 
                    int columnIndex = c 
                            .getColumnIndex(DownloadManager.COLUMN_STATUS); 
                    if (DownloadManager.STATUS_SUCCESSFUL == c 
                            .getInt(columnIndex)) { 
 
                    } else if(DownloadManager.ERROR_FILE_ALREADY_EXISTS == c.getInt(columnIndex)){ 
                    	Toast.makeText(Download.this, "This file already Exists!", Toast.LENGTH_LONG); 
                    } 
                } 
            } 
        } 
    };