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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:04:17+00:00 2026-05-28T16:04:17+00:00

My actual task is getting completed however I am not getting any increase in

  • 0

My actual task is getting completed however I am not getting any increase in the progress status of my progress bar even if i call the progress dialog..?can anyone say where I did wrong?

class A extends AsyncTask<File[],Integer,Void>
                {
                    private Context cnt;
                        int count=0;
                    @Override
                    protected void onPreExecute() {
                         pd = new ProgressDialog(cnt);
                            pd.setMessage("Matching progress");
                            pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                            pd.setMax(100);
                            pd.setCancelable(false);
                            pd.setProgress(0);
                            pd.show();
                    }
                    A(Context context)
                    {
                        cnt=context;
                    }

                    protected Void doInBackground(File[]... params) {
                        // TODO Auto-generated method stub
                        File[] newfiles=params[0];
                        File[] temp=null;
                        int progress=0;
                        int dircnt=0;
                        int numberofdir=newfiles.length;
                        for(File b:newfiles)
                        {


                            count=0;
                            dirname=b.getName();
                            if(b.isDirectory())
                            {

                                temp=b.listFiles();
                            }
                            for(File a:temp)
                            {
                                gest=dotask.batchprocess(a.getPath());
                                if(gest!=null)
                                    System.out.println("success");
                                String name=dirname+"_"+count;
                                saveGesture(name, gest);
                                count++;

                            }
                            dircnt++;
                             progress=(int)((dircnt/numberofdir)*100);
                            publishProgress(progress);


                        }


                        return null;
                    }
                    @Override
                    protected void onProgressUpdate(Integer... values) {
                        // increment progress bar by progress value
                        pd.setProgress(values[0]);


                }
                     protected void onPostExecute() {
                        pd.hide();
                        pd=null;
                     }
    }

below is the method from which I call the AsyncClass.

 public void addgestures()
    {
                cView.postInvalidate();
                dotask.setH(cView.getH());
                dotask.setW(cView.getW());

                count=0;
                files=null;
                /*if(dir.isDirectory()) 
                {
                    files=dir.listFiles();
                }*/
                files=dir.listFiles();
                for(int i=0;i<files.length;i++)
                {
                    System.out.println(files[i].getPath());
                }




                A a=new A(this);
                a.execute(files);



            }
  • 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-28T16:04:18+00:00Added an answer on May 28, 2026 at 4:04 pm

    Your integer math is broken. The line

    progress=(int)((dircnt/numberofdir)*100);
    

    will always yield 0 because integer division truncates to just the integer portion.

    To fix it, just use floats instead. Specifically:

    float dircnt=0;
    float numberofdir=newfiles.length;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How I can get the actual memory used in my C# application? Task Manager
How I can get actual folder path where my program is without my exe
I know in an actual query, you can use auto_increment=1 but how is this
This is not an actual Xcode error message, it is a warning that has
The question probably sounds a little odd, but the actual task is relatively simple,
This is a moot question as I'm not on this project any more, but
My task is to check (>trillions checks), does two int contain any of predefined
For a particular task, I need bars on my bar graph to overlap. Currently,
My task is to find the actual Press release links of a given link.
I'm coding a WinForm component where I start a Task to do the actual

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.