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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:25:50+00:00 2026-06-15T22:25:50+00:00

I am trying to create a progress bar which does not need to show

  • 0

I am trying to create a progress bar which does not need to show percentages.

public boolean onOptionsItemSelected( MenuItem item ) {
    switch( item.getItemId() ) {
        case R.id.back:
            this.dispatchKeyEvent( new KeyEvent( KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK ) );
            finish();
            return true;
        case R.id.read:
            // This is where I would start my spinner....
            if( myService.getState() != 3 ) {
                myService.connect( MainMenu.previousDevice, true );
            }
            readWaves();
            return true;
        default:
            return super.onContextItemSelected( item );
    }
}

The spinner will stop itself in the readWaves() function…

private void readWaves() {
        waveResults = RelayAPIModel.NativeCalls.GetWavesJava( RelayAPIModel.WAVES_V );
        // Turn the Spinner off Here.
        doOtherThings();
    }

I have found tons of code all over telling me how to use a progress bar using threads, adding the progress bar in the xml file, and many other methods.

I think the best way for me to do it would be to create a CustomDialog class to pop up and have the spinner spin until I call to end it.

The first answer shown here is by far the closest I have come to finding what I want, but unfortunately his solution does not work. The reason it does not work is because of the last section of code:

public MyProgressDialog(Context context) {
    super(context, R.style.NewDialog);
}

I am using Android 2.3 and there is no style attribute of R. I try to add it myself and get an error. Does anyone know how to fix this?

EDIT:

This is the code I tried using a ProgressDialog

case R.id.read:
            pDialog = new ProgressDialog( Waves.this );
            pDialog.setTitle( "Waves" );
            pDialog.setMessage( "Reading..." );
            pDialog.show();
            if( myService.getState() != 3 ) {
                myService.connect( MainMenu.previousDevice, true );
            }
            readWaves();
            return true;
        default:
            return super.onContextItemSelected( item );
    }
}

private void readWaves() {
    if( spinnerChoice == 0 ) {
        Log.i( "IN IF", "IN IF" );
        // Diff Voltage
        waveResults = RelayAPIModel.NativeCalls.GetWavesJava( RelayAPIModel.WAVES_V );
    } else {
        // Current 
        waveResults = RelayAPIModel.NativeCalls.GetWavesJava( RelayAPIModel.WAVES_I );
    }
    Log.i( "READ WAVES", "After If/Else" );
    pDialog.dismiss();
    /*
  • 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-15T22:25:51+00:00Added an answer on June 15, 2026 at 10:25 pm

    There is already a Dialog that is created for this specific purpose. Check out ProgressDialog. You can use it like this:

    //show the dialog
    ProgressDialog pd = new ProgressDialog(YourActivity.this);
    pd.setTitle("Your title");
    pd.setMessage("Helpful message to the user");
    pd.show();
    
    /**************
    * Do some stuff
    **************/
    
    //Hide the dialog
    pd.dismiss();
    

    EDIT: Here is a small sample of how it would look in the options menu:

    public boolean onCreateOptionsMenu(Menu menu) {  
        menu.add(0, 42, 0, "Option"); 
        return true;  
    }  
    public boolean onOptionsItemSelected(MenuItem item) {  
        switch (item.getItemId()) {  
        case 42: 
               ProgressDialog pd = new ProgressDialog(this);
               pd.show();
            break;
        default:
            //Do nothing      
        }  
        return false;  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help on this. I'm trying to create a simple progress bar based
I'm trying to create a simple app for android with progress bar . Everything
I am trying to find the best option to create a simple progress bar
I am trying to create downloading progress. I have my class which extends AsyncTask:
I'm trying to create a progress bar that will work asynchronously to the main
I am trying to create a download progress bar in python using the urllib2
I am trying to create a mini progress bar that will indicate how much
So I'm trying to create a progress bar using the following images: This is
I am trying to create an upload progress bar with PHP. I saw the
I am trying to create a loading progress bar for my function: private string

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.