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" /> + + + +