Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.annotation.TargetApi;

import android.app.DownloadManager;
import android.content.Context;

import android.os.Build;

public class Main {
    /**
     * Attempts to remove the download with the given ID from the system's download manager, if
     * available.
     * 
     * @see {@link DownloadManager#remove(long...)}
     */
    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
    public static void removeFromDownloadManager(Context context, long id) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
            DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
            if (downloadManager != null) {
                downloadManager.remove(id);
            }
        }
    }
}