Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • TextClock in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 275
    Comment on it

    Hi Friends, TextClock is used to show the current time or/and date. In TextClock we use formatted String to show the time or/and date. Basically it is a digital clock added from Api level 17 replacement of DigitalClock. By using this method we get values either getFormat12Hour() or getFormat24Hour().
    Is24HourModeEnabled()

    Here is the code

    1. Button showTextClock = (Button) findViewById(R.id. button);
    2. showTextClock.setOnClickListener(new OnClickListener() {
    3. @Override public void onClick(View v) {
    4. // TODO Auto-generated method stub
    5. // Defining Text Clock
    6. TextClock textClock = (AnalogClock) findViewById(R.id. my_text_clock);
    7. // Showing Text clock
    8. textclock.setVisibility(View.VISIBLE);
    9. } });
    10. } }

    This is the xml file of the Activity

    1. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
    2. android:layout_width="match_parent"
    3. android:layout_height="match_parent">
    4. <textclockclock android:id="@+id/my_text_clock"
    5. android:layout_width="wrap_content"
    6. android:layout_height="wrap_content"
    7. android:visibility="invisible">
    8. <button android:id="@+id/ button"
    9. android:layout_width="wrap_content"
    10. android:layout_height="wrap_content"
    11. android:text="Show Text Clock">
    12. </button>
    13. </textclockclock>
    14. </linearlayout>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: