I would like to store only .txt filenames from a specific dir (let's say: /sdcard/docs/) into an String array.
Example:
In /sdcard/docs/ there are 5 files: foo.txt, bar.jpg, foofoo.txt, loool.png and     foobar.txt. I would like to get array with contents: "foo.txt", "foofoo.txt", "foobar.txt"
How开发者_Go百科 could I do it?
List all files:
https://developer.android.com/reference/java/io/File.html#list%28%29
or
List with filter:
https://developer.android.com/reference/java/io/File.html#list%28java.io.FilenameFilter%29
Just pass your path to the File constructor, and call one of the above methods on it.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论