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 9235915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:09:55+00:00 2026-06-18T07:09:55+00:00

my working task is to read sd card files and i want to show

  • 0

my working task is to read sd card files and i want to show all sdcard files with location on textview but,my code is reading successfully but,i can’t update textview text while reading files is not working after i find solution runonuithread but,it’s also not working.my code is shown below:

public void scan (final File path) {

            try
            {
                for (final File f : path.listFiles()) {
                    if (f.isFile()) {
                      scannedfiles=scannedfiles+1;
                      progresspercentage=scannedfiles*100/FilesCount;   


                      MainActivity.this.runOnUiThread(new Runnable() {

                          @Override
                          public void run() {
                              lbl_scan.setText("SCANING:"+f.getAbsolutePath());\\first time only change text after didn't change
                              Toast.makeText(getApplicationContext(),"Files:"+f.getAbsolutePath(),Toast.LENGTH_SHORT).show(); 
                          }
                      });


                    }
                    else {
                        if(!f.getName().equals("Android"))
                        {
                            scan(f);
                        }
                    }
                }

            }
            catch (Exception e) 
            {

            }
        }

i am calling scan function below code:

 File root = new File (Environment.getExternalStorageDirectory().getAbsolutePath());
 scan(root);

can any one help me greatly appreciated.

  • 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-06-18T07:09:57+00:00Added an answer on June 18, 2026 at 7:09 am

    You might be calling scan on the UI Thread! This should be obvious if the whole UI is blocking during the operation.

    Try:

    new Thread() {
        public void run() {
            scan(root);
        }
    }.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a task to read SD card files and I am
Hi i've been working on a task of porting some code from some old
I am working on task involving reading from the socket trading quotes and I
My company is working on a project that needs to read XML files within
I've read all the documentation on the subject, but it seems I can't grasp
I know that it is an easy task, but after changing my code it
I am working on a Download Manager project, so, to show all downloaded /
i'm working on a task that i want to convert text file into PDF
I am currently working on project whose main task is to read data stored
Can anyone give me the working example of reading two files simultaneously through threads?

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.