From 91b429e5427107b867b02d4be986cc5756d9531e Mon Sep 17 00:00:00 2001 From: Azerothwav Date: Mon, 2 Dec 2024 16:56:26 +0100 Subject: [PATCH] feat: add lastname --- .idea/other.xml | 329 ++++++++++++++++++ .../java/com/example/test/MainActivity.java | 7 +- app/src/main/res/layout/activity_main.xml | 17 +- app/src/main/res/values/strings.xml | 2 + 4 files changed, 351 insertions(+), 4 deletions(-) create mode 100644 .idea/other.xml diff --git a/.idea/other.xml b/.idea/other.xml new file mode 100644 index 0000000..104e542 --- /dev/null +++ b/.idea/other.xml @@ -0,0 +1,329 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/test/MainActivity.java b/app/src/main/java/com/example/test/MainActivity.java index 52340f8..ebe7a72 100644 --- a/app/src/main/java/com/example/test/MainActivity.java +++ b/app/src/main/java/com/example/test/MainActivity.java @@ -15,6 +15,7 @@ import androidx.core.view.WindowInsetsCompat; public class MainActivity extends AppCompatActivity { private EditText etPrenom; + private EditText etNom; private Button btValider; private TextView tvMessage; private String prenom; @@ -34,14 +35,16 @@ public class MainActivity extends AppCompatActivity { private void initialisations() { etPrenom = (EditText) findViewById(R.id.etPrenom); + etNom = (EditText) findViewById(R.id.etNom); btValider = (Button) findViewById(R.id.btEnvoyer); tvMessage = (TextView) findViewById(R.id.tvMessage); btValider.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String prenom = etPrenom.getText().toString(); - tvMessage.setText("Hello " + prenom + "!"); - Toast.makeText(getApplicationContext(), "Coucou " + prenom + " !", Toast.LENGTH_LONG).show(); + String nom = etNom.getText().toString(); + tvMessage.setText("Hello " + prenom + " " + nom +"!"); + Toast.makeText(getApplicationContext(), "Coucou " + prenom + " " + nom +" !", Toast.LENGTH_LONG).show(); } }); } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b07d0f6..89476cd 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -24,8 +24,21 @@ android:layout_height="wrap_content" android:ems="10" android:hint="@string/libSaisiePrenom" - android:inputType="text" - android:text="@string/libSaisiePrenom" /> + android:inputType="text" /> + + + +