Search code examples
androidandroid-intentrequestandroid-download-manager

Android Cannot Instantiate the type Request


I have the following code for downloading a file using a download service. Apparently there are no errors.But eclipse is showing the error "Cannot instantiate type Request" near Request request = new Request(Uri.parse(downUrl)); I couldn't find any issue with my code.So why is it happening.How to fix it? Since my code has syntax highlighting issues in stackoverflow please find it here


Solution

  • Change your import from import org.omg.CORBA.Request; to import android.app.DownloadManager.Request;

    Here's a nice complete example of DownloadManager too, in case it helps: http://blog.vogella.com/2011/06/14/android-downloadmanager-example/.