Currently I have three textviews which I am using for the countdown timer in my android app in HH:MM:SS. (hours, minutes and seconds). I am allowing the user to set the textviews to a specific number for the time. I am then trying to get the value from the textviews by converting to int and then using the integer values as the seconds for the countdown timer. But the problem is that there is no values for the ints, and therefore the timer cannot start.

As the user drags around the scrubber he can change the textview value for hours, minutes, or seconds:
Here is the code for that below in my onCreate method:
@Override
public void onProgressChanged(SeekArc seekArc, int progress,
boolean fromUser) {
int progress_count = 0;
for (int i=0;i<24;i=i+1)
{
if (progress ==120) {
mSeekArcProgress.setText("24");
}
else if (progress == progress_count)
{
mSeekArcProgress.setText(String.valueOf(String.format("%02d",i)));
}
progress_count = progress_count + 5;
}
}
});
} else if (v.getId() == R.id.minutetext) {
//corresponding button logic should below here
mSeekArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() {
@Override
public void onStopTrackingTouch(SeekArc seekArc) {
}
@Override
public void onStartTrackingTouch(SeekArc seekArc) {
}
//This sets the actual string for the minutes
@Override
public void onProgressChanged(SeekArc seekArc, int progress,
boolean fromUser) {
int progress_count = 0;
for (int i=0;i<120;i++)
{
if (progress ==120) {
mSeekArcMinuteProgress.setText("00");
}
else if (progress == progress_count)
{
mSeekArcMinuteProgress.setText(String.valueOf(String.format("%02d",i)));
}
progress_count = progress_count + 2;
}
}
});
} else if (v.getId() == R.id.secondtext) {
//corresponding button logic should below here
mSeekArc.setOnSeekArcChangeListener(new SeekArc.OnSeekArcChangeListener() {
@Override
public void onStopTrackingTouch(SeekArc seekArc) {
}
@Override
public void onStartTrackingTouch(SeekArc seekArc) {
}
//This sets the actual string for the seconds
@Override
public void onProgressChanged(SeekArc seekArc, int progress,
boolean fromUser) {
// so ur setting it to HALF of what "progress" is = to
int progress_count = 0;
for (int i=0;i<60;i++)
{
if (progress ==120) {
mSeekArcSecondProgress.setText("00");
}
else if (progress == progress_count)
{
mSeekArcSecondProgress.setText(String.valueOf(String.format("%02d",i)));
}
progress_count = progress_count + 2;
}
}
});
}
The TextView ID's are referenced in the following code which is in my setActionListener method for the countdown timer:
private void setActionListeners() {
// IT IS RIGHT BELOW CHECK IT OUT.
number_text = (TextView) findViewById(R.id.hour_progress_number);
minute_text = (TextView) findViewById(R.id.minute_progress_number);
second_text = (TextView) findViewById(R.id.second_progress_number);
hourint = Integer.valueOf(number_text.getText().toString());
minuteint = Integer.valueOf(minute_text.getText().toString());
secondint = Integer.valueOf(second_text.getText().toString());
totalTimeCountInMilliseconds = ((hourint*60*60) +(minuteint*60) + (secondint)) * 1000; // time count for 3 minutes = 180 seconds
timeBlinkInMilliseconds = totalTimeCountInMilliseconds/1000;
start_timer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// textViewShowTime.setTextAppearance(getApplicationContext(), R.style.normalText);
countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) {
// 500 means, onTick function will be called at every 500 milliseconds
@Override
public void onTick(long leftTimeInMilliseconds) {
long seconds = leftTimeInMilliseconds / 1000;
mSeekArc.setVisibility(View.INVISIBLE);
if ( leftTimeInMilliseconds < timeBlinkInMilliseconds ) {
// textViewShowTime.setTextAppearance(getApplicationContext(), R.style.blinkText);
// change the style of the textview .. giving a red alert style
if ( blink ) {
number_text.setVisibility(View.VISIBLE);
minute_text.setVisibility(View.VISIBLE);
second_text.setVisibility(View.VISIBLE);
// if blink is true, textview will be visible
} else {
number_text.setVisibility(View.INVISIBLE);
minute_text.setVisibility(View.INVISIBLE);
second_text.setVisibility(View.INVISIBLE);
}
blink = !blink; // toggle the value of blink
}
second_text.setText(String.format("%02d", seconds % 60));
minute_text.setText(String.format("%02d", seconds / 60));
number_text.setText(String.format("%02d", seconds / 3600)); // format the textview to show the easily readable format
}
@Override
public void onFinish() {
// this function will be called when the timecount is finished
//textViewShowTime.setText("Time up!");
number_text.setVisibility(View.VISIBLE);
minute_text.setVisibility(View.VISIBLE);
second_text.setVisibility(View.VISIBLE);
mSeekArc.setVisibility(View.VISIBLE);
}
}.start();
}
});
}
The timer works went I put an explicit integer value for totalTimeCountInMilliseconds; however, when I use hourint, minuteint, and secondint the value is probably zero because the timer doesn't start and that seems like that is the only valid reason.
I am not sure what to do the fix this so I can get integer values and make the timer work.
EDIT: Pastebin for full code link: http://pastebin.com/1wcXHdvX