MainActivity -


  package com.example.lifecyclemethod;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import android.util.Log;


public class MainActivity extends AppCompatActivity {


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        Log.d("Android", "onCreate Called");

    }


    @Override

    protected void onStart() {

        super.onStart();

        Log.d("Android", "onStart Called");

    }


    @Override

    protected void onResume() {

        super.onResume();

        Log.d("Android", "onResume Called");

    }


    @Override

    protected void onPause() {

        super.onPause();

        Log.d("Android", "onPause Called");

    }


    @Override

    protected void onStop() {

        super.onStop();

        Log.d("Android", "onStop Called");

    }


    @Override

    protected void onRestart() {

        super.onRestart();

        Log.d("Android", "onRestart Called");

    }


    @Override

    protected void onDestroy() {

        super.onDestroy();

        Log.d("Android", "onDestroy Called");

    }

}


--------------------------------------------------------------------------------------------------------------------------------


activity_main -


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

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

    android:orientation="vertical"

    tools:context=".MainActivity">


    <TextView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="Life Cycle Method"

        android:textSize="30sp" />


</LinearLayout>


------------------------------------------------------------------------------------------------------------------------


AndroidManifest -


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

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

    android:orientation="vertical"

    tools:context=".MainActivity">


    <TextView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="Life Cycle Method"

        android:textSize="30sp" />


</LinearLayout>



Comments

Popular posts from this blog

Generate Signing Release keystore

πŸš€ COMPLETE CI/CD FROM SCRATCH

Camera Application