Reputation: 61
How to show a list of all PDF files stored in assets folder or Raw folder in resource folder
Upvotes: 2
Views: 800
Reputation: 3001
create a file object with your path to raw folder then call
file.listFiles();
this will return list of all files then filter these files with .pdf extension
// edited
AssetManager assetManager = mContext.getAssets();
String[] arrData = assetManager.list("pdfFolder");//name of your directory as assets/pdfFolder/abc.pdf
List<String> pdfList = new ArrayList<String>();
int size = arrData.length();
for(int i = 0;i<size;i++)
{
if(arrData[i].contains(".pdf"))
{
pdfList.add(arrData[i]);
}
}
Upvotes: 1