Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.palmitessa;
- import androidx.annotation.NonNull;
- import androidx.appcompat.app.AppCompatActivity;
- import android.os.Bundle;
- import android.util.Log;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- public class MainActivity extends AppCompatActivity {
- private final String TAG = "Palmitessa.HelloWorld";
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- final TextView textHW = (TextView)findViewById(R.id.textView);
- final Button apply = (Button) findViewById(R.id.button);
- final Button clear = (Button) findViewById(R.id.button2);
- final EditText edit = (EditText) findViewById(R.id.editText);
- apply.setOnClickListener(new Button.OnClickListener() {
- @Override
- public void onClick(View v){
- textHW.setText(edit.getText().toString());
- }
- });
- clear.setOnClickListener(new Button.OnClickListener() {
- @Override
- public void onClick(View v){
- textHW.setText(R.string.clearText);
- }
- });
- Log.i(TAG, " -onCreate- Set bottone Apply e Clear");
- }
- @Override
- protected void onStart() {
- super.onStart();
- //...
- Log.i(TAG, " -onStart- The activity is visible and about to be started.");
- }
- @Override
- protected void onRestart() {
- super.onRestart();
- //...
- Log.i(TAG, " -onRestart- The activity is visible and about to be restarted.");
- }
- @Override
- protected void onResume() {
- super.onResume();
- //...
- Log.i(TAG, " -onResume- The activity has focus (it is now \"resumed\")");
- }
- @Override
- protected void onPause() {
- super.onPause();
- Log.i(TAG,
- " -onPause- Another activity is taking focus (this activity is about to be \"paused\")");
- }
- @Override
- protected void onStop() {
- super.onStop();
- //...
- Log.i(TAG, " -onStop- The activity is no longer visible (it is now \"stopped\")");
- }
- @Override
- protected void onDestroy() {
- super.onDestroy();
- //...
- Log.i(TAG, " -onDestroy- The activity is about to be destroyed.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement