0% found this document useful (0 votes)
32 views3 pages

Hello World Program by Pranav Mhatre

The document describes two Android programs. The first program displays the text "Hello World!" on the screen. The second program displays a student's name and marks in a table, with the student's roll number, name, and marks in separate cells of the table. Both programs use XML layout files and Java code to set the user interface and handle events.

Uploaded by

Pranav Mhatre
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)
32 views3 pages

Hello World Program by Pranav Mhatre

The document describes two Android programs. The first program displays the text "Hello World!" on the screen. The second program displays a student's name and marks in a table, with the student's roll number, name, and marks in separate cells of the table. Both programs use XML layout files and Java code to set the user interface and handle events.

Uploaded by

Pranav Mhatre
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

Practical No.

4
Aim: Develop a program to display Hello World on screen

X. Exercise
1. Write a program to display HelloWorld.
activity_main.xml Output:

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


<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">

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

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Roll no 31-Pranav Mhatre"
android:textSize="20sp" />
</[Link]>

[Link]

package com..exp4;

import [Link];
import [Link];

public class MainActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
}
}
2. Write a program to display student name and marks.
activity_main.xml Output:

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


<TableLayout
xmlns:android="[Link]
"
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
tools:context=".MainActivity">

<TableRow android:padding="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Roll No"
android:textSize="25sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"

android:text="Student Name"
android:textSize="25sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Marks"
android:textSize="25sp"/>
</TableRow>
<TableRow android:padding="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="31"
android:textSize="25sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Pranav Mhatre"
android:textSize="25sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="98"
android:textSize="25sp"/>
</TableRow>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="30dp"
android:text="Done by 31-Pranav Mhatre"
android:textSize="25sp"/>
</TableLayout>
[Link]

package [Link].experiment4_2;

import [Link];

import [Link];

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
}
}

You might also like