How To Show The Current Time in TextView in Widget

1.2k views Asked by At

I want to show the current time in updatable textView I can't find the true way to make it I want it to be updated every minute Please anyone can help me ? Thanks

3

There are 3 answers

0
Flavio  Torres On BEST ANSWER
Calendar cal = Calendar.getInstance();
SimpleDateFormat oSimpleDateFormat = new SimpleDateFormat("HH:mm:ss");
String MyString= oSimpleDateFormat.format(cal.getTime()); 
EditText oEditText =(EditText) findViewById(R.id.MyEdit);
oEditText.setText(MyString);

try this

0
Ufkoku On

You should use ScheduledThreadPoolExecutor.scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)

http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html

0
Ali Imran On

use the digital clock tag Digital Clock built in android studio 2.1. Here it is built in tag to show time < Digital Clock > don't use space b/w digital and clock, it was having problem while posting the answer.