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)