0

I am making to show progressbar on postexecute and to be not visible in postExecute, and it works, but makes the app to work very slow, what is the reason is there any simple way to make it work normal(not slowly)? This is my code:

bar = (ProgressBar) this.findViewById(R.id.progressBar);     
getInfo extends AsyncTask<void, void, void>{   
    protected void onPreExecute() {   
        bar.setVisibility(View.VISIBLE);
    }   
    protected void doInBackground(String... params)                                                  
                  do smth}  
    protected void onPostExecute(Boolean results) {
              bar.setVisibility(View.GONE);
    }
}
4
  • from where do you invoke asynctask Jan 16, 2014 at 11:24
  • post the code where you invoke asynctask by editing your post. Jan 16, 2014 at 11:35
  • Would it start working at a normal speed if I put the code:"bar.setVisibility(View.VISIBLE);" where I invoke asynctask, and leave the code:"bar.setVisibility(View.GONE);" in onPostExecute? Thank you again :) Jan 16, 2014 at 12:12
  • i asked you to post the code here on stackoverflow by editing your post so that either me or someone will be able to help Jan 16, 2014 at 12:30

1 Answer 1

1

Are you using a custom progress bar and are you showing the progress bar at the initial screen of your application?

If you are using a custom progress bar then it might take some time to load during the initial startup of your app. I had a similar issue and the issue was due to the android:type="sweep" in the custom progress bar. EG: below

    <shape>
        <gradient
            android:startColor="#000001"
            android:centerColor="#ffffff"
            android:centerY="0.5"
            android:type="sweep"/>
    </shape>

Not sure why the type="sweep" could cause the issue but, after removing it, the application seemed to start up pretty quick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.