0% found this document useful (0 votes)
13 views19 pages

Hemal AP - Cropped

import ppt6

Uploaded by

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

Hemal AP - Cropped

import ppt6

Uploaded by

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

Android Programming - Lab (03606352) Enrollment No:210339616061

Practical-1

Aim: Installation and setup of java development kit(JDK), setup android


SDK, setup eclipse IDE, setup android development tools(ADT) plugins,
create androidvirtual device.

Step 1:

Click on the "Download Android Studio" option.

Step 2:

Accept the terms and conditions and click on download option.

PIET-DS(CE) Page 1
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 3:

"Android Studio Setup" will appear on the screen and click "Next" to proceed.

Step 4:

Select the components that you want to install and click on the "Next" button.

PIET-DS(CE) Page 2
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 5:

Now, browse the location where you want to install the Android Studio and click
"Next" to proceed.

Step 6:
Choose a start menu folder for the "Android Studio" shortcut and click the "Install"
button to proceed.

PIET-DS(CE) Page 3
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 7:

Installing of Android Studio started.

Step 8:

After the successful completion of the installation, click on the "Next" button.

PIET-DS(CE) Page 4
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 9:

Click on the "Finish" button to proceed.

Step 10:

Once “Finish” is clicked, it will ask whether the previous settings need to be
imported or not.

PIET-DS(CE) Page 5
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 11:

This will start Android Studio.

Meanwhile, it will be finding the available SDK Components.

Step 12:

After it has found the SDK Component, it will redirect Welcome Dialog Box.

PIET-DS(CE) Page 6
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 13:

Click on next.

PIET-DS(CE) Page 7
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 14:

Click on Finish. License Agreement will be approved.

Step 15:

Now, it is time to download the SDK Components.

PIET-DS(CE) Page 8
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 16:

Click on Finish. Components begin to download let it complete.

PIET-DS(CE) Page 9
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 17:

Create a new project.

PIET-DS(CE) Page 10
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 18:

Then, name your application in the ‘Application name’ Text box.

PIET-DS(CE) Page 11
Android Programming - Lab (03606352) Enrollment No:210339616061

PIET-DS(CE) Page 12
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 19:

This will allow the app to access it as public and private.

PIET-DS(CE) Page 13
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 20:

SDK Components will be installed.

Step 21:

Click Create Virtual Device, at the bottom of the AVD Manager dialog.

PIET-DS(CE) Page 14
Android Programming - Lab (03606352) Enrollment No:210339616061

Step 22:

Android Virtual Device is creating.

Step 23:

Change AVD properties as needed, and then click Finish.

PIET-DS(CE) Page 15
Android Programming - Lab (03606352) Enrollment No:210339616061

Practical-2
Aim: Create a Hello World Application. That will display “Hello World” in
themiddle of the screen using text view Widget in the text box.\

Java Program

package com.example.helloworld

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);

PIET-DS(CE) Page 16
Android Programming - Lab (03606352) Enrollment No:210339616061

Activity.xml

<?xml version="1.0" encoding="utf-8"?>


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.andr
oid.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="first.javatpoint.com.welcome.MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Android!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
}

PIET-DS(CE) Page 17
Android Programming - Lab (03606352) Enrollment No:210339616061

Output:

PIET-DS(CE) Page 18
Android Programming - Lab (03606352) Enrollment No:210339616061

Practical-3

Aim: Create an application for demonstrate Android activity lifecycle.

Java Program

package example.javatpoint.com.activitylifecycle;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("lifecycle","onCreate invoked");
}
@Override
protected void onStart() {
super.onStart();
Log.d("lifecycle","onStart invoked");
}
@Override
protected void onResume() {
super.onResume();
Log.d("lifecycle","onResume invoked");
}
@Override
protected void onPause() {
super.onPause();
Log.d("lifecycle","onPause invoked");
}

PIET-DS(CE) Page 19

You might also like