custom DownloadManager but initialization it fail
<p>DownloadManager of the system is sdk 2.3,i want to use it at &lt;2.3 device,so i copy code from source,but  </p>

<p>i  call it :</p>

<pre><code>public long startDownload(Uri downloadUri, boolean onlyWifi)
{

    DownloadManager.Request request = new DownloadManager.Request(downloadUri);
    request.setTitle("Test Download File"); // 
    request.setDescription("App Name");
    //request.setDestinationInExternalFilesDir(context, dirType, subPath);
    request.setDestinationInExternalPublicDir("/sdcard", "test.mp4");


    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);

    final DownloadManager dManager = (DownloadManager)TestDownloadManager.this.getSystemService("download");
    return dManager.enqueue(request);
}
</code></pre>

<p>but it give me :</p>

<pre><code>03-21 06:57:21.181: ERROR/AndroidRuntime(420): Caused by: java.lang.NullPointerException
03-21 06:57:21.181: ERROR/AndroidRuntime(420):     at com.test.DownloadManager.TestDownloadManager.startDownload(TestDownloadManager.java:32)
03-21 06:57:21.181: ERROR/AndroidRuntime(420):     at com.test.DownloadManager.TestDownloadManager.onCreate(TestDownloadManager.java:16)
03-21 06:57:21.181: ERROR/AndroidRuntime(420):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
</code></pre>

<p>i post download.java at </p>

<p><a href="https://gist.github.com/2145469" rel="nofollow">https://gist.github.com/2145469</a></p>
