Android AnalogClock : setting drawables programmatically Android AnalogClock : setting drawables programmatically xml xml

Android AnalogClock : setting drawables programmatically


you actualy draw drawables once(when activity starts) of course there is some animations and alot of thing that change the look of activity but not drawablesyou can use drawable for different objects in activity like having one style for each button but you can not redraw.

you have 2 ways to do this project:

1.using XMLs

you can make 15 diffrent activities and by Intent you can switch between activities

public void method(){    Intent i = new Intent(this , Destination.class);    startActivity(i);}

2.using codes

anything that can be designed using XMLs also can be written via java codes. it takes more lines but it can be dynamic it means you don't have to make if else for each condition ; you simply produce needed objects each time it is needed .

examples:

Xml

<Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/button_text"... />

or programmatically:

Button button = new Button(this); YourView.addview(button);