prac_3A(AMP)

Practical 3A

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:id="@+id/textView"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Hello world”

tools:layout_editor_absoluteX="37dp"

tools:layout_editor_absoluteY="205dp" />

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.kt

package com.example.tyit_724_6_1_25

import androidx.appcompat.app.AppCompatActivity

import android.os.Bundle

import android.util.Log

import android.widget.Toast

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.activity_main)

Toast.makeText(this,"724-you are at onCreate Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onCreate Phase")

}

override fun onStart() {

super.onStart()

Toast.makeText(this,"724-you are at onStart Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onStart Phase")

}

override fun onResume() {

super.onResume()

Toast.makeText(this,"724-you are at onResume Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onResume Phase")

}

override fun onPause() {

super.onPause()

Toast.makeText(this,"724-you are at onPause Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onPause Phase")

}

override fun onStop() {

super.onStop()

Toast.makeText(this,"724-you are at onStop Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onStop Phase")

}

override fun onDestroy() {

super.onDestroy()

Toast.makeText(this,"724-you are at onDestroy Phase",

Toast.LENGTHLONG).show()

Log.d("tag1","724-you are at onDestroy Phase")

}

}

Comments

Popular posts from this blog

python(BI)

(PP-7)Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which takes the parameters x and y (these should all be numbers). i. Write a method called add which returns the sum of the attributes x and y. ii. Write a class method called multiply, which takes a single number parameter a and returns the product of a and MULTIPLIER. iii. Write a static method called subtract, which takes two number parameters, b and c, and returns b - c. iv. Write a method called value which returns a tuple containing the values of x and y. Make this method into a property, and write a setter and a deleter for manipulating the values of x and y.