Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7575075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:35:45+00:00 2026-05-30T16:35:45+00:00

I got a little problem. I got a map (on android phone) called Save,

  • 0

I got a little problem.
I got a map (on android phone) called “Save”, in that folder I got several .txt files.

I know how to enter the folder, and I can read 1 txt file (hardcoded) but I want it to be dynamic.

I want somehting like this:

public void onClick(View v) {

             File root = Environment.getExternalStorageDirectory();

             save = root.toString()+"/Save/";

                if (save.startsWith("3_test")){
                    System.out.println("FOUND!");
                } else {
                    System.out.println("NOT FOUND!");
                }

        }

I got a txt file called 3_test.txt but he can’t find it this way, if I do it hardcoded it does find it.

The problem is that I don’t know how to “scan” all files in the folder Save and then put an “if” check over it.

Hope someone can help me with this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:35:46+00:00Added an answer on May 30, 2026 at 4:35 pm

    I think your code won’t work in Java either: your save variable contais the path to the folder Save, under de root folder.
    To achieve a filtered directory listing, you can try using the list() method on the File object for the Save folder, passing a custom java.io.FilenameFilter implementation, so it will scan the whole content of the target folder, and returning only the names of the files that match your constraint:

     public void onClick(View v) {
    
             File root = Environment.getExternalStorageDirectory();
             File saveFolder= new File(root, "Save");
    
             String[] files=saveFolder.list(
                new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                    //define here you filter condition for every single file
                        return name.startsWith("3_test");
    
                    }
                });
    
             if(files.length>0) {
                 System.out.println("FOUND!");
             } else {
                 System.out.println("NOT FOUND!");
             }
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a little problem. I programmed a winforms application that recursivly searches files
I've got a little problem that's slightly frustrating. Is it possible to set a
I got a little problem i need a sql query that gives all rows
I got a little problem with datamapper, and I'd like to know if there
I've got a little problem: I don't know whether it is possible to select
I have got a little problem with repositioning a div that should serve as
I've got this silly problem (called Internet Explorer) that keeps breaking on something that
i`ve got a little problem with LINQ. I read out some information via XML-RPC.
I got a little problem. Sometimes, when I try to call the following code,
I've got a little problem with Zend Framework Zend_Pdf class. Multibyte characters are stripped

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.