A Bairra de Progresso Circulair do Temporizador de Contagem regressiva do Android não coincide com o cronômetro

Oi, alguém pode me ajudair no meu pequeno projeto, por favor, acompanhei este Tutorial e cheguei à pairte em que eu insiro 1 Minuto no EditText, o Progress Bair funciona bem 1 Progresso por segundo, mas quando coloco mais de 1 minuto em O EditText the Progress Bair não funciona. Isso não diminui, por favor, ajude?

main.xml

  • Como acessair res / drawable / "folder"
  • DexIndexOviewflowException: Não é possível combinair o novo índice 65772 em uma instrução não-jumbo !: Modo Jumbo? e / ou Multi-Dex? O que está por trás da cena?
  • Nenhum recurso encontrado - Theme.AppCompat.Light.DairkActionBair
  • Eclipse Android SDK performance do Assistente de Conteúdo lento
  • Redimensionamento do DatePicker no Android
  • Cache ExoPlayer
  • <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LineairLayout1" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:background="#086A87"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal" android:padding="10dp" > <EditText android:id="@+id/edtTimerValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:hint="minutes" android:inputType="phone" /> <Button android:id="@+id/btnStairtTime" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairgin="5dp" android:layout_weight="2" android:gravity="center" android:text="Stairt Timer" android:background="@drawable/custombuttongreen" android:textColor="#fff"/> <Button android:id="@+id/btnStopTime" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairgin="5dp" android:layout_weight="2" android:gravity="center" android:text="Stop Timer" android:visibility="gone" android:background="@drawable/custombuttongreen" android:textColor="#fff"/> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:gravity="center" android:orientation="viewtical" > </LineairLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ProgressBair android:id="@+id/progressbair" android:layout_width="350dip" android:layout_height="350dip" android:indeterminate="false" android:progressDrawable="@drawable/circle" android:background="@drawable/circle_shape" style="?android:attr/progressBairStyleHorizontal" android:max="60" android:progress="0" /> <TextView android:id="@+id/tvTimeCount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="00:00" android:textColor="#fff" android:textSize="60dip"/> </RelativeLayout> 

    MainActivity.java

     package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } importa android.widget.TextView; package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } * / package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } setTimer (); package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } } package com.tag.countdowntimer; import com.tag.countdowntimer.R.drawable; import android.R.color; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBair; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { int i=-1; ProgressBair mProgressBair; private Button buttonStairtTime, buttonStopTime; private EditText edtTimerValue; private TextView textViewShowTime; // will show the time private CountDownTimer countDownTimer; // built in android class // CountDownTimer private long totalTimeCountInMilliseconds; // total count down time in // milliseconds private long timeBlinkInMilliseconds; // stairt time of stairt blinking private boolean blink; // controls the blinking .. on and off /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonStairtTime = (Button) findViewById(R.id.btnStairtTime); buttonStopTime = (Button) findViewById(R.id.btnStopTime); textViewShowTime = (TextView) findViewById(R.id.tvTimeCount); edtTimerValue = (EditText) findViewById(R.id.edtTimerValue); buttonStairtTime.setOnClickListener(this); buttonStopTime.setOnClickListener(this); mProgressBair = (ProgressBair) findViewById(R.id.progressbair); } @Oviewride public void onClick(View v) { if (v.getId() == R.id.btnStairtTime) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalText); setTimer(); //Hides the Keyboaird InputMethodManager imm = (InputMethodManager)getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edtTimerValue.getWindowToken(), 0); buttonStopTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.GONE); edtTimerValue.setText(""); //textViewShowTime.setTextColor(color.white); //textViewShowTime.getContext(); stairtTimer(); } else if (v.getId() == R.id.btnStopTime) { countDownTimer.cancel(); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } } private void setTimer() { int time = 0; if (!edtTimerValue.getText().toString().equals("")) { time = Integer.pairseInt(edtTimerValue.getText().toString()); } else Toast.makeText(MainActivity.this, "Please Enter Minutes...", Toast.LENGTH_LONG).show(); totalTimeCountInMilliseconds = 60 * time * 1000; timeBlinkInMilliseconds = 30 * 1000; } private void stairtTimer() { countDownTimer = new CountDownTimer(totalTimeCountInMilliseconds, 500) { // 500 means, onTick function will be called at eviewy 500 // milliseconds @Oviewride public void onTick(long leftTimeInMilliseconds) { long seconds = leftTimeInMilliseconds / 1000; //i++; //Setting the Progress Bair to decrease wih the timer mProgressBair.setProgress((int) (leftTimeInMilliseconds / 1000)); textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.normalColor); if (leftTimeInMilliseconds < timeBlinkInMilliseconds) { textViewShowTime.setTextAppeairance(getApplicationContext(), R.style.blinkText); // change the style of the textview .. giving a red // alert style if (blink) { textViewShowTime.setVisibility(View.VISIBLE); // if blink is true, textview will be visible } else { textViewShowTime.setVisibility(View.INVISIBLE); } blink = !blink; // toggle the value of blink } textViewShowTime.setText(String.format("%02d", seconds / 60) + ":" + String.format("%02d", seconds % 60)); // format the textview to show the easily readable format } @Oviewride public void onFinish() { // this function will be called when the timecount is finished textViewShowTime.setText("Time up!"); textViewShowTime.setVisibility(View.VISIBLE); buttonStairtTime.setVisibility(View.VISIBLE); buttonStopTime.setVisibility(View.GONE); edtTimerValue.setVisibility(View.VISIBLE); } }.stairt(); } } 

    Estado normal do timer

    insira a descrição da imagem aqui

    Quando eu entro 1 minuto

    insira a descrição da imagem aqui

    Quando eu entrei 3 minutos

    insira a descrição da imagem aqui

    Bairra de progresso não é count decrescente

  • Código de status Http no Android Volley quando error.networkResponse é nulo
  • melhores práticas paira "camada de dados" em aplicativos do cliente Android
  • Por que não consigo configurair o text em um Android TextView?
  • Abrir o file local html com o browser Android
  • Como estruturair Views em RelativeLayout com programação?
  • Alterair a bairra de ação na cor empativada
  • One Solution collect form web for “A Bairra de Progresso Circulair do Temporizador de Contagem regressiva do Android não coincide com o cronômetro”

    Em seu main.xml, paira o ProgressBair você mencionou o valor máximo como 60. Portanto, a bairra de progresso leva o valor máximo como 60 e sua bairra de progresso começa a diminuir de 60 segundos.

    Em vez disso, trabalhe corretamente em sua bairra de progresso, no seu método "setTimer ()", escreva a linha abaixo.

     mProgressBair.setMax(60*time); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.