For example, I have DigitalClock and TextView in MainActivity. How to fix time in TextView (24-hour format) in a moment of time when the Application is launched?
Fix the time from DigitalClock?
190214-Oct-2014
Updated on 14-Oct-2014
Home / DeveloperSection / Forums / Fix the time from DigitalClock?
Takeshi Okada
14-Oct-2014String time= "Time : " + DateFormat.getTimeFormat(getContext()).format(new Date(calendar.getTimeInMillis()));
This will return to the user smth like : " Time : 13:11"
Assuming you are using an instance of calendar somewhere in your code.
If not simply get an instance of calendar like this (it will return current device time ) :
Calendar calendar = Calendar.getInstance();
Anonymous User
14-Oct-2014