Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make Digital clock in android?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 153
    Comment on it

    Using below code I have created Digital clock app in android. Android digital clock is used to show time in android app. In android, digitalclock is the sub class of TextView class. Here below code example will help you create Digital Clock function in android.


    Srep(1)- activity_main.xml

    <RelativeLayout xmlns:androclass="http://schemas.android.com/apk/res/android"  
        xmlns:tools="http://schemas.android.com/tools"  
        android:layout_width="match_parent"  
        android:layout_height="match_parent"  
        tools:context=".MainActivity" >  
    
        <AnalogClock  
            android:id="@+id/analogClock1"  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:layout_alignParentTop="true"  
            android:layout_centerHorizontal="true"  
            android:layout_marginTop="22dp" />  
    
        <DigitalClock  
            android:id="@+id/digitalClock1"  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:layout_below="@+id/analogClock1"  
            android:layout_centerHorizontal="true"  
            android:layout_marginTop="81dp"  
            android:text="DigitalClock" />  
    
    </RelativeLayout>  
    

    Step(2)- MainActivity.class

    public class MainActivity extends Activity {  
    
        @Override  
        protected void onCreate(Bundle savedInstanceState) {  
            super.onCreate(savedInstanceState);  
            setContentView(R.layout.activity_main);  
        }  
    
        @Override  
        public boolean onCreateOptionsMenu(Menu menu) {  
            getMenuInflater().inflate(R.menu.activity_main, menu);  
            return true;  
        }  
    }  
    

 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: