@Override public void onDestroy() { super.onDestroy(); // Toast.makeText(getApplicationContext(),"16. onDestroy()", // Toast.LENGTH_SHORT).show(); Log.e("time in mills", time + ""); long seconds = time / 1000; long minutes = seconds / 60; seconds = seconds % 60; long hours = minutes / 60; minutes = minutes % 60; String timestr = hours + ":" + minutes + ":" + seconds; Log.e("time in hh:mm:ss", timestr); reports.updateDuration(aid, timestr); }