开发者

How to read only text file from sdcard in android?

HI...

I am New To Android, My requirement is to display Total SDcard files in Listview , in that i w开发者_JAVA技巧ant to read only TextFiles. Can anyone HelpMe.... Thanks in advance...


You should check out FilenameFilter.

Something like this:

FilenameFilter filter = new FilenameFilter() {          
    @Override
    public boolean accept(File dir, String filename) {
        return (filename.endsWith(".txt"));
    }
};

And:

String[] list = dir.list(filter);

There you go! :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜