0% found this document useful (0 votes)
7 views

Practical 17

The document contains an XML file defining a ConstraintLayout and a Java file with an activity that logs the activity lifecycle methods as they are called.

Uploaded by

shahidhakim0992
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)
7 views

Practical 17

The document contains an XML file defining a ConstraintLayout and a Java file with an activity that logs the activity lifecycle methods as they are called.

Uploaded by

shahidhakim0992
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/ 2

XML FILE:

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

</androidx.constraintlayout.widget.ConstraintLayout>

JAVA FILE:

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.util.Log;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity{

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Log.d("lifecycle","onCreate invoked by meena talele");

protected void onStart(){

super.onStart();

Log.i("lifecycle","onStart invoked");

}
protected void onResume(){

super.onResume();

Log.v("lifecycle","onResume invoked");

protected void onPause() {

super.onPause();

Log.d("lifecycle", "onPause invoked");

protected void onStop(){

super.onStop();

Log.d("lifecycle","onStop invoked");

protected void onRestart(){

super.onRestart();

Log.d("lifecycle","onRestart invoked");

protected void onDestroy(){

super.onDestroy();

Log.d("lifecycle","onDestroy invoked");

You might also like