Note that there are some explanatory texts on larger screens.

plurals
  1. POprogress bar - no info just loading bar
    text
    copied!<p>Below is my code for just a simple progress bar.</p> <p>My questions are: </p> <ul> <li>How do I delete the text/information that appears on that pop-up progress bar, so there is ony the yelow bar? </li> <li><p>And also, can I change the color from yellow to blue?</p> <pre><code>public class MainActivity extends Activity { Button btnStartProgress; ProgressDialog progressBar; private int progressBarStatus = 0; private Handler progressBarHandler = new Handler(); private long fileSize = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); addListenerOnButton(); } public void addListenerOnButton() { btnStartProgress = (Button) findViewById(R.id.button1); btnStartProgress.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // progress bar dialog progressBar = new ProgressDialog(v.getContext()); progressBar.setCancelable(true); progressBar.setMessage("Progress Bar ... "); progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressBar.setProgress(0); progressBar.setMax(100); progressBar.show(); //reset progress bar status progressBarStatus = 0; //reset filesize fileSize = 0; new Thread(new Runnable() { public void run() { while (progressBarStatus &lt; 100) { // process some tasks progressBarStatus = Tasks(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } // Update the progress bar progressBarHandler.post(new Runnable() { public void run() { progressBar.setProgress(progressBarStatus); } }); } // progress 100% if (progressBarStatus &gt;= 100) { // sleep 2 seconds, so that you can see the 100% try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } // close the progress bar dialog progressBar.dismiss(); } } }).start(); } }); } public int Tasks() { while (fileSize &lt;= 1000000) { fileSize++; if (fileSize == 100000) { return 10; } else if (fileSize == 200000) { return 20; } else if (fileSize == 300000) { return 30; } else if (fileSize == 500000) { return 50; } else if (fileSize == 900000) { return 90; } } return 100; }} </code></pre></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload