Scan 25 Mar 25 09 44 02
Scan 25 Mar 25 09 44 02
Steps
studio to create an Android
will use Android
You it as DatePicker under a
and name
pplication
th com.example.datepicker.
package file to add
Modify src/MainActivity.java
2
code.
necessary to add
the res/layout/activity_main
3 Modify
XML Components.
respective to add
the res/values/string.xml
4 Modify
string
components.
necessary
orted a running
and choose
uary 5 Run the application on it
the application
and install
android device
package com.example.datepicker;
Calendar;
importjava.util.
are
Jimport android.app.Activity;
import android.app.DatePickerDialog;
int
import android.os.Bundle;
|import android.view.Menu:
import android.widget.Toast;
private TextViewdateView;
@Override
protected void
onCreate(Bundle
savedInstanceState)
super.onCreate(savedlnstanceState):
setContentView{R.lavout.actívity
main):
Mabile Application
Development (MSBTE Sem-6
Comp/|T) 4-45 View
ldate View =
(TextView) Designing User Interface with
findViewByld(R.id.textView3):
calendar= showDate(argl, arg2+1,
Calendar.getInstance(): arg3):
append(month).appendC).append(year)):
@SuppressWamings("'deprecation")
public void setDate(View view){
showDialog(999);
Following is the modified content of the xml
Toast.makeText(getApplicationContext(), "'ca', res/layout/activity_main.xml.
show); <RelativeLayout
} xmlns:android="http://schemas.android.com/apk/res/an
droid"
@Override
xmlns:tools ="htp://schemas.android.com/tools"
protected Dialog onCreateDialog(int id) {
android:layout width="match parent"
TODO Auto-generated mnethod stub
|android:paddingBottom="@dimen/activity_vertical ma
return new DatePickerDialog(this, rgin"
android:paddingTop="@dimen/activity_ vertical_margin
private
larg3 = day
android:text="@string/date button_set"/>
TechKnowledge
PublCatinns
with
User Interface View
Designing
4-46
Comp/lT) selected"
Development (MSBTE Sem-6
Application
Motbile android:text="@string/date
"?android:attr/textAppearance
<TextView Jandroid:textAppearance=
textView)"
Mediun"/>
android:id="@+id
|</RelativeLayout> xroi
width='wrap content"
the res/values/string.
android:lavout
is the contentof
Following
android:lavout
height="wrap content"
encoding="utf-8"?>
android:layout_alignarentTop="ue"
<?ml version="l.0"
centerHorizontal=tne" <resources>
android:lavout
name"> DatePicker</string>
marginTop="2kdp" <string name="app
android:layout </stríng>
settings">Settings
date abel set"
name="action
android:text=@string <string >
world!</stríng
="?android:attr/textAppearance world"> Hello
android:textAppearance <string name="hello se
the button to
Medium> label set'Press
<string name"date
<Textliew
the date </string
>
Date </string
android:id="@+id textView2" button set">Set
<string name="date
width="wrap content" view set"> TheDate is:
android:layout
<string name="date
android:lavout height="wrap_content" </string >
>
below="@+id buttonl" selected'></string
android:lavout <string name="date
Ul by using following UI
android:textAppearance="?android:attr/textAppearance Q.1 Design a rich
Medium" Component.
android:id="@+id/textView3" UI
Q.2 Design a student registration form using
android:layout_ alignRight="@+id/buttonl"
Q.4 Explain signiticance of displaying Alert.
android:layout below="@+id/textView2"
Q.5 Develop application for date-time picker.
android:layout marginTop="72dp"