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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:02:16+00:00 2026-05-24T06:02:16+00:00

I am trying to increment my progress bar on a broadcast recieved but the

  • 0

I am trying to increment my progress bar on a broadcast recieved but the myProgressDialog.incrementProgressBy(increment); code has no effect from my point of view. I have tried placing the command in different places but I still can see no effect at all.

Here is what my code looks like.

public static final int max = 180;
public final static int increment = (1/180);

  @Override
   public void onCreate(Bundle savedInstanceState) {
            ...
        i = new Intent();
    i.setAction(ITEM_CREATED);
    registerReceiver(myBroadcastReceiver, new IntentFilter(ITEM_CREATED));              
        findFeeds = new Runnable(){
           @Override
           public void run() 
            {
              getFeedObjects();
            }
           };
           beginThread();
        } 

 public static Context getAppContext() {
    return context;
}

private void beginThread()
{
    switch (checkConnectionState(OffsideLiteActivity.this))
    {
        case 0:
        thread =  new Thread(null, findItems, "DoingInBackground");
        thread.start();
        myProgressDialog = new ProgressDialog(this);
            myProgressDialog.setCancelable(true);
            myProgressDialog.setMessage("Loading...");
            myProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            myProgressDialog.setProgress(0);
            myProgressDialog.setMax(max);
            myProgressDialog.show();

        break;
        case 1:
        connectionError();
        break;
        default:
    }
}

     private BroadcastReceiver myBroadcastReceiver =
    new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) 
        {
            myProgressDialog.incrementProgressBy(increment);
            Log.d("RECEIVED", "Broadcast received");
        }

   };

The interesting part is that logcat registers the Broadcast received log that i placed after the myProgressDialog.incrementProgressBy(increment); code

logcat

08-03 13:56:15.109: DEBUG/RECEIVED(8666): Broadcast received
08-03 13:56:15.109: DEBUG/RECEIVED(8666): Broadcast received
08-03 13:56:15.109: DEBUG/RECEIVED(8666): Broadcast received
08-03 13:56:15.109: DEBUG/RECEIVED(8666): Broadcast received
08-03 13:56:15.109: DEBUG/RECEIVED(8666): Broadcast received

Like I said I have tried putting the myProgressDialog.incrementProgressBy(increment); command elsewhere in my code, but to no avail. Any suggestion?

  • 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-24T06:02:16+00:00Added an answer on May 24, 2026 at 6:02 am

    The problem might be this line:

    public final static int increment = (1/180);
    

    I believe that int will be truncated to 0, so you’re only ever incrementing the progress dialog by 0. You probably want increment to be 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a file upload progress bar working in a rails 3
I am trying to increment a version number using regex but I can't seem
I'm trying to increment through JQuery loop to fill out some HTML code with
I am trying to increment a variable from 0-99, and return the value each
Im trying to update a progress bar while doing some data type checks on
I'm trying to atomically increment a simple counter in Django. My code looks like
I am trying to increment a counter, but I would like to move the
I am trying to get auto increment ID from the last query and update
I am trying to increment a variable using the ++ operator but I keep
I am trying to work with UIStepper to increment or decrement an integer, but

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.