0% found this document useful (0 votes)
67 views6 pages

AIM:-Create "First Android Application", That Will Display "LDRP-ITR" in The

This document describes two Android app development practical exercises. The first aims to create an app that displays text in blue on a white background. It provides the XML layout and Java code. The second practical aims to demonstrate the sequence of callback methods involved in starting and tearing down an Android activity. It provides the XML layout and Java code with logging of method calls. The output shows the logged method calls in the Android monitor.

Uploaded by

Meet Bhanderi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views6 pages

AIM:-Create "First Android Application", That Will Display "LDRP-ITR" in The

This document describes two Android app development practical exercises. The first aims to create an app that displays text in blue on a white background. It provides the XML layout and Java code. The second practical aims to demonstrate the sequence of callback methods involved in starting and tearing down an Android activity. It provides the XML layout and Java code with logging of method calls. The output shows the logged method calls in the Android monitor.

Uploaded by

Meet Bhanderi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Mobile Application Development with ANDROID 1620BEIT30032

Practical:-1
AIM:- Create “First Android Application”, that will display “LDRP-ITR” in the
middle of the screen in the Blue color with White background.

activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LDRP-ITR"
android:textColor="#003BB8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.java:
package com.example.practical1;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

LDRP-ITR Page | 1
Mobile Application Development with ANDROID 1620BEIT30032

Output:

LDRP-ITR Page | 2
Mobile Application Development with ANDROID 1620BEIT30032

Practical:-2
AIM:- Android system initiates its program with in an Activity starting with a
call on onCreate() callback method. There is a sequence of callback methods
that start up an activity and a sequence of callback methods that tear down an
activity. Create an app to demonstrate it.

activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.java:
package com.example.practical2;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("onCreate","onCreate: ");
}

LDRP-ITR Page | 3
Mobile Application Development with ANDROID 1620BEIT30032

@Override
protected void onStart() {
super.onStart();
Log.d("onStart", "onStart: ");
}

@Override
protected void onPause() {
super.onPause();
Log.d("onPause", "onPause: ");
}

@Override
protected void onResume() {
super.onResume();
Log.d("onResume", "onResume: ");
}

@Override
protected void onRestart() {
super.onRestart();
Log.d( "onRestart", "onRestart: ");
}

@Override
protected void onStop() {
super.onStop();
Log.d( "onStop", "onStop: ");
}

@Override
protected void onDestroy() {
super.onDestroy();
Log.d( "onDestroy", "onDestroy: ");
}
}

LDRP-ITR Page | 4
Mobile Application Development with ANDROID 1620BEIT30032

Output:

LDRP-ITR Page | 5
Mobile Application Development with ANDROID 1620BEIT30032

LDRP-ITR Page | 6

You might also like