Android : store file details from sdcard in database
I have a program which uses imag开发者_开发知识库es and audio which i place in a specific directory in the sdcard.
I need to store the details of these files (file path, file name) into a database. Is there a way to scan this particular folder and retrieve these details and store them into the database?
You can use the standard file functions
File directory = new File("your file path");
File file[] = directory.listFiles();
System.out.println("The length of files is " + file.length);
for(int i=0;i<file.length;i++)
{
//for each file object get any details you wish to using the standard functions...jst google :)
}
now for storing the details in the DB use a datahelper.
精彩评论