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

Ap-2 241

Cv

Uploaded by

deepvaghela461
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)
14 views3 pages

Ap-2 241

Cv

Uploaded by

deepvaghela461
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/ 3

Android Programming Lab (03606352) Enrollment No: 210339616241

Practical: 2

Aim: - Create a “Hello World” application. That will display


“Hello World” in the middle of the screen using TextView Widget
in the red colour.

Java Code

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.example.demoapp.R;

public class MainActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

XML Code

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

<?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!"

android:textColor="#E42112"

app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintStart_toStartOf="parent"

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

app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

PIET-DS(CE) Page | 3

You might also like