Javaturtle Javaturtle - 1 year ago 147
Android Question

Android Studio Method implementation

The main goal is to give you practice determining what methods are called
during the lifecycle of your app. You must do each task and record
which methods were called and in what order. The following methods should be overwritten
so you can determine which ones are being called and when:

• onCreate

• onStart

• onResume

• onPause

• onStop

• onRestart

• onDestroy

• onSaveInstanceState

• onRestoreInstanceState

• onConfigurationChanged

package com.example.martij62.myapplication;

import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

public class MainActivity extends AppCompatActivity {

protected void onCreate(Bundle savedInstanceState ) {
setContentView(R.layout.activity_landscape) ;
} else {
setContentView(R.layout.activity_main) ;
getWindow().setSoftInputMode (
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) ;

How am I suppose to implement all of these methods into my code? Whenever I try I get errors. I'm unsure how to run all of these at once or individually. He wants us to implement and find out what each one does.

Answer Source

Use a method under create method.

protected  onstart()
Log.i(app."on Pause")

Do that for each method and watch the log as its called.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download