Issue
I want to be able to access all of the files in the raw folder of the resources folder in my Android application package. I have created a function that gets an array of files from a folder in the external storage directory, but I want to do the same thing for the files in the raw folder of the resources folder. I have looked at different suggestions, but most people seem to want to access a specific file. I only want to access the folder and then create an array of files in that folder. Please could anyone help me with this to find a solution. Thanks in advance.
Here is the code for my other function that I have created:
public static List<String> getListOfSavedFileNames()
{
File folder = new File(Environment.getExternalStorageDirectory() + "/XML/");
List<String> listOfFileNames = new ArrayList<String>();
if(folder.exists())
{
File[] listOfFiles = folder.listFiles();
for(File f : listOfFiles)
{
String fileName = f.getName();
String finalFileName = FileExtentionFunctions.removeExtention(fileName);
listOfFileNames.add(finalFileName);
}
}
else
{
}
return listOfFileNames;
}
Solution
There are no files. Raw resources are resources, not files.
You are welcome to:
Have a "table of contents" resource that lists the other ones, as a
<string-array>
or an XML resource or somethingUse reflection to iterate over the
R.raw
values
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.