Hi I am making boxing countdowntimer. And I would like to set on text view "end" after all tasks. But I don't know how to do that. During the round I see that (pic1)
and during the break I see that (pic2)
And how make a condition to see "end" after all tasks because I am using handler function to repeat this for example 2 times and when I set condition " if (!tv1.getText().toString().equals("Przerwa"){ tv3.setText("end")
but "end" shows me every single break.
Btw. runda means rund and this is= tv1 1/2= tv2 2-3-2=tv3 00:03=tv4
tv means -textview
Przerwa means break
timerododliczania = new CountDownTimer(1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
btn1.setVisibility(View.INVISIBLE);
tv2.setText("" + millisUntilFinished / 1000);
}
@Override
public void onFinish() {
MediaPlayer boksring=MediaPlayer.create(Main3Activity.this,R.raw.rin9 );
boksring.start();
int liczbarund = 1;
tv4.setText(ilo??rund);
try {
liczbarund = Integer.parseInt(tv4.getText().toString());
} catch (Exception ex) {
Toast.makeText(cntx, "Invalid Integer", Toast.LENGTH_LONG).show();
return;
}
if (liczbarund == 0) {
return;
}
final int[] round_count = {0};
final int finalNum_rounds = liczbarund;
final int[] round_count1 = {0};
final int finalNum_rounds1 = liczbarund;
final int[] round_count2 = {0};
final int finalNum_roundsp = liczbarund;
timerodrundy = new CountDownTimer(d?rundy, 1000) {
@Override
public void onTick(long millisUntilFinished) {
btn1.setVisibility(View.VISIBLE);
tv1.setText("Runda");
tv5.setText( (round_count1[0] + 1) + "/" + finalNum_rounds1);
mTimeLeftInMillis = millisUntilFinished;
updatetext();
}
@Override
public void onFinish() {
tv1.setText("Przerwa");
MediaPlayer r1=MediaPlayer.create(Main3Activity.this, R.raw.rinknkw);
r1.start();
if (licz > 1) {
round_count[0]++;
if (round_count[0] < finalNum_rounds) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
start();
}
}, d?przerwy);
}
}
if (!tv2.getText().toString().equals("00:00")){
tv3.setText("Koniec");
}
}
}.
start();
timerodkombosa = new CountDownTimer(d?rundy, 5000) {
@Override
public void onTick(long millisUntilFinished) {
final Random rand = ThreadLocalRandom.current();
tv3.setText(kombosy[new Random().nextInt(kombosy.length)]);
int resourceID = R.raw.rin1;
switch (tv3.getText().toString()) {
case "1-2":
resourceID = R.raw.rin1;
break;
case "1-1-2":
resourceID = R.raw.rin2;
break;
case "1-2-3-2":
resourceID = R.raw.rin3;
break;
case "1-2-5-2":
resourceID = R.raw.rin4;
break;
case "1-6-3-2":
resourceID = R.raw.rin5;
break;
case "2-3-2":
resourceID = R.raw.rin6;
break;
}
player = MediaPlayer.create(Main3Activity.this, resourceID);
player.start();
}
@Override
public void onFinish() {
tv5.setText("");
tv3.setText("");
if (licz > 1) {
round_count1[0]++;
if (round_count1[0] < finalNum_rounds1) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
start();
}
}, d?przerwy);
timerodprzerwy = new CountDownTimer(d?przerwy, 1000) {
@Override
public void onTick(long millisUntilFinished) {
mTimeLeftInMillis = millisUntilFinished;
updatetext();
}
@Override
public void onFinish() {
MediaPlayer r2=MediaPlayer.create(Main3Activity.this, R.raw.rinnkr);
r2.start();
CountDownTimer countDownTimer= new CountDownTimer(1000,1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
}
}.start();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…