Click here to Skip to main content
16,020,811 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
how to get list of text files stored in android Sd card
Posted

You could try something like this;

Java
File files[] = Environment.getExternalStorageDirectory().listFiles();
for(File file : files) {
  String filePath = file.getAbsolutePath();
}


Then you can traverse those entries using whatever logic applies to your application.

Hope this helps,
Fredrik
 
Share this answer
 
try below to get all txt files

Java
File files[] = Environment.getExternalStorageDirectory().listFiles(
		new FilenameFilter() {
			@Override
			public boolean accept(File dir, String filename) {
					return ((filename.endsWith(".txt")));
			}
		});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900