在我的应用程序中,我从图库中的文件夹中获取图像并将其保存到数组列表中。现在我只想提取扩展名为 .jpg 的文件。我该怎么做
保存到数组列表的代码是
private List<String> ReadSDCard()
{
//It have to be matched with the directory in SDCard
File f = new File("sdcard/data/crak");
File[] files=f.listFiles();
for(int i=0; i<files.length; i++)
{
File file = files[i];
/*It's assumed that all file in the path are in supported type*/
tFileList.add(file.getPath());
}
return tFileList;
}