java - How can i get the value from a textclock -


in app have textclock displaying current hour , want when click button value textclock , put in string variable. have this:

textclock time = (textclock) findviewbyid(r.id.horas); horas = time.gettext().tostring(); 

and in layout textclock this:

<textclock     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/horas"     android:textsize="30dp"     android:layout_below="@+id/space2"     android:layout_centerhorizontal="true" /> 

but returns empty value.

this should do:

time.getformat12hour(); 

or:

time.getformat24hour(); 

you have working clock this:

image shows working digital clock matches system time


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -