After pressing the button, you need to display how much time has passed since the creation of Activiti.
Closed due to the fact that the essence of the question is incomprehensible to the participants dirkgntly , αλεχολυτ , pavel , Ivan Pshenitsyn , Denis 25 Aug '16 at 11:52 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- And what exactly is the problem? - pavel
|
1 answer
public class MainActivity extends AppCompatActivity { private TextView mTimeTextView; private Button mTimeButton; private Calendar mStartTime; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mStartTime = Calendar.getInstance(); mTimeTextView = (TextView) findViewById(R.id.time_text_view); mTimeButton = (Button) findViewById(R.id.time_button); mTimeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Calendar nowTime = Calendar.getInstance(); long secs = (nowTime.getTimeInMillis() - mStartTime.getTimeInMillis())/1000; mTimeTextView.setText(String.valueOf(secs)); } }); } }
|