0% found this document useful (0 votes)
547 views5 pages

03 - Hands On Activity1 MB

The document contains code for an Android application that overrides the activity lifecycle methods onCreate, onStart, onResume, onPause, onStop, onRestart, and onDestroy. Each method calls the super method and displays a toast notification with the name of the lifecycle method.

Uploaded by

ron venancio
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)
547 views5 pages

03 - Hands On Activity1 MB

The document contains code for an Android application that overrides the activity lifecycle methods onCreate, onStart, onResume, onPause, onStop, onRestart, and onDestroy. Each method calls the super method and displays a toast notification with the name of the lifecycle method.

Uploaded by

ron venancio
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/ 5

Ronquilo B.

Venancio
BSIT-701E
03 Hands-on-Activity 1

OUTPUT:

INPUT:

CODE:

package com.mycompany.myapp;

import
android.app
.*; import
android.os.
*; import
android.wid
get.*;
import
android.con
tent.*;

public class MainActivity extends Activity


{

@Override

protected void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

Toast.makeText(getApplicationContext(),"Created!",
Toast.LENGTH_SHORT).show();

@Override

protected void onStart()

//TODO: Implement this method


super.onStart();

Toast.makeText(getApplicationContext(), "Started!",
Toast.LENGTH_SHORT).show();

@Override

protected void onResume()

//TODO: Implement this method

super.onResume();
Toast.makeText(getApplicationContext(), "Resume!",
Toast.LENGTH_SHORT).show();

@Override

protected void onPause()

//TODO: Implement this method


super.onPause();
Toast.makeText(getApplicationContext(), "Paused!" ,
Toast.LENGTH_SHORT).show();

}
@Override
protected void onStop()
{
//TODO: Implement this method super.onStop();
Toast.makeText(getApplicationContext(), "Stopped!",
Toast.LENGTH_SHORT).show();
}
@Override
protected void onRestart()
{
//TODO: Implement this method super.onRestart();
Toast.makeText(getApplicationContext(), "Restarted!",
Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy()
{
//TODO: Implement this method super.onDestroy();
Toast.makeText(getApplicationContext(), "Destroyed!",
Toast.LENGTH_SHORT).show();
}
}

You might also like