When I call the function() I want to have a chance to cancel the SOS call, If I click the button.
Basically It reads Integer.parseInt(cancelTime.getText().toString())
that has a time in second to be able to cancel.
My problem is that I'm trying to show like a countdown of the time elapsed from Integer.parseInt(cancelTime.getText().toString())
to 0 and it appears a huge number: ex: 10546468261
private void function()
{
startTime = System.currentTimeMillis();
Runnable runnable = new Runnable() {
@Override
public void run() {
double elapsedTime = (System.currentTimeMillis() - startTime)/1000;
alertButton.setText("CANCEL THE SOS: " + (int)elapsedTime);
alertButton.setBackgroundColor(Color.parseColor("#FF0000"));
}
};
Handler handler = new Handler();
handler.postDelayed(runnable, Integer.parseInt(cancelTime.getText().toString()));
}