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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3.06k
    Comment on it

    Hi Friends, Analog clock is a two handed clock, one shows hour and other shows minutes. It looks like a normal clock. Android provides AnalogClock to show the time.

    Here is the code :-

    Button buttonClock = (Button) findViewById(R.id. change_button);
    buttonClock.setOnClickListener(new OnClickListener() {
    @Override public void onClick(View v) {
    // TODO Auto-generated method stub
    // Defining Analog Clock
    AnalogClock analogClock = (AnalogClock) findViewById(R.id. my_analog_clock);
    // Showing Analog clock
    analogclock.setVisibility(View.VISIBLE);
    } });
    } }
    

    This is the xml file of the Activity :-

    <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent" android:layout_height="match_parent">
    analogclock android:id="@+id/my_analog_clock" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:visibility="invisible">
    
    <button android:id="@+id/change_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Click Me">
    
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: