0% found this document useful (0 votes)
20 views2 pages

Practical No 04

This document provides code to display the text "Hello World!" in an Android app. It includes an XML layout file with a TextView widget constrained to the parent layout that contains the message. It also includes a Java file for the MainActivity class that sets the content view to the layout file on creation. When run, the app will display "Hello World!" as the output.

Uploaded by

Vaibhav Bhagwat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
20 views2 pages

Practical No 04

This document provides code to display the text "Hello World!" in an Android app. It includes an XML layout file with a TextView widget constrained to the parent layout that contains the message. It also includes a Java file for the MainActivity class that sets the content view to the layout file on creation. When run, the app will display "Hello World!" as the output.

Uploaded by

Vaibhav Bhagwat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Practical No: 4

 Write a Program To Display Hello World.

 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.pdfconvertor.mad;

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 );
}
}
 Output:

You might also like