Jerrin George
Jerrin George

Reputation: 317

Android : store file details from sdcard in database

I have a program which uses images 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?

Upvotes: 1

Views: 423

Answers (1)

Nitin
Nitin

Reputation: 1451

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.

Upvotes: 0

Related Questions