Search code examples
androidimportbroadcastreceiverandroid-download-managerandroid-implicit-intent

How do i import a file from my system downloads folder into the raw directory


I am downloading a .csv file from the internet on my Android phone. This isn't done through my app. However, I want to import this file from the system downloads folder into my raw directory. I select a button in the action bar and call the method below. I'm new to Android and the developer docs kind of suck for beginners. I'm not sure where to start. This is what I've come up with.

I create this implicit intent:

Intent i = new Intent();
        i.setAction(DownloadManager.ACTION_VIEW_DOWNLOADS);
        startActivity(i);

and it shows me the downloads folder. How can I select something from this folder and import it into my raw directory? Do I need to set up a broadcast reciever? Do I need an intent filter? Should I use a service? Am I using the wrong Intent action?

Please cut me a little slack. I'm new and I don't see a lot of good explanations of the process. I would be just as happy if someone just pointed me in the right direction. Thanks in advance.


Solution

  • How can I select something from this folder and import it into my raw directory?

    I assume that by "my raw directory", you are referring to raw resources (res/raw/ in an Android project).

    If so, resources are read-only at runtime. They are files on your development machine; they are not files on the device. You cannot import things in any fashion that turn them into raw resources at runtime.