0

I am parsing sky blue color with hax color as Color.parseColor("#5bc0de"). But don't know why it is showing green type color. I am using it with ProgressBar as pbScore.getProgressDrawable().setColorFilter( Color.parseColor("#5bc0de"), Mode.MULTIPLY);

Am I doing anything wrong ?

I am testing this on real mobile device. I am using HTC One M9+.

XML Code :

<ProgressBar
                android:id="@+id/pbScore"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="60"
                android:progress="0" />

Java Code :

QuestionTimer cdtScore;
int iScore = 0;

pbScore = (ProgressBar) rootView.findViewById(R.id.pbScore);

public class QuestionTimer extends CountDownTimer {
        public QuestionTimer(long millisInFuture, long countDownInterval) {
            super(millisInFuture, countDownInterval);
        }

        public void onTick(long millisUntilFinished) {
            iScore++;
            pbScore.setProgress(iScore);

            if (iScore > 0 && iScore <= 15) {
                pbScore.getProgressDrawable().setColorFilter(
                        Color.parseColor("#f0ad4e"), Mode.MULTIPLY);
            } else if (iScore > 15 && iScore <= 30) {
                pbScore.getProgressDrawable().setColorFilter(
                        Color.parseColor("#5cb85c"), Mode.MULTIPLY);
            } else if (iScore > 30 && iScore <= 45) {
                pbScore.getProgressDrawable().setColorFilter(
                        Color.parseColor("#5bc0de"), Mode.MULTIPLY);
            } else if (iScore > 45) {
                pbScore.getProgressDrawable().setColorFilter(
                        Color.parseColor("#d9534f"), Mode.MULTIPLY);
            }

            pbScore.setProgress(iScore);
        }

        public void onFinish() {
            iScore = 0;
            pbScore.setProgress(iScore);
        }
    }

cdtScore = new QuestionTimer(60000, 1000);
cdtScore.start();
Jeeten Parmar
  • 5,568
  • 15
  • 62
  • 111

0 Answers0