I have the following two programs progress, countDownTimer that works but need to combine them to achieve what I want.Please see the image below.
I have the following issues.
Progress bar not smooth
Countdown time is going up and down and not counting down correctly
public class MainActivity extends ActionBarActivity { TextView tv2; ProgressBar pBar2; int pStatus = 0; private Handler handler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv2 = (TextView) findViewById(R.id.textView2); pBar2 = (ProgressBar) findViewById(R.id.progressBar2); new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub while (pStatus < 100) { pStatus += 1; handler.post(new Runnable() { @Override public void run() { new CountDownTimer(10000, 1000) { @Override public void onTick(long millisUntilFinished) { pBar2.setProgress(pStatus); tv2.setText("" + millisUntilFinished / 1000); } @Override public void onFinish() { tv2.setText("Go!"); } }.start(); } }); try { // Sleep for 200 milliseconds. // Just to display the progress slowly Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start(); }