I am listing all the files in the "shared prefs" directory of an app. There are 3 shared prefs in total: "User.xml" and "Note_1.xml" and "Note_2.xml".
File f = new File("/data/data/com.bhiruva/shared_prefs/");
String[] pathnames;
pathnames = f.list();
That is the code I am using for listing all the files in that folder, but I need to list the files which only have the title starting as "note_"…
Can someone please tell me how to do this? Thanks in Advance
2
Answers
You could do this:
Use a FilenameFilter to accept only the disired files:
Or shorter using lambdas if you are using Java 8 or higher