ad728

Tuesday, January 31, 2017

AIDE Tutorial - 30 Adding Clock

AIDE Tutorial - 30 Adding Clock

For more support watch the video below

Main XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<TextView android:text="Analog Clock" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<AnalogClock android:id="@+id/mainAnalogClock" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="Digital Clock" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<DigitalClock android:id="@+id/mainDigitalClock" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
Main Activity JAVA
package com.mycompany.myapp;
import android.app.*;
import android.os.*;
import android.widget.*;
public class MainActivity extends Activity
{@Override
protected void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AnalogClock ac=(AnalogClock)findViewById(R.id.mainAnalogClock);
DigitalClock dc=(DigitalClock)findViewById(R.id.mainDigitalClock);}}
Note: For making this app actually you don't need to set ID in XML and findViewById in Java it also works without them
Share:

Total Pageviews

Sponsor

Sponsor

ad300