开发者

Android : store file details from sdcard in database

开发者 https://www.devze.com 2023-03-13 21:16 出处:网络
I have a program which uses imag开发者_开发知识库es and audio which i place in a specific directory in the sdcard.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号