Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package com.example.testdoc;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4. import android.os.Bundle;
  5.  
  6. //Importation de la class TextView nécessaire pour son utilisation
  7. import android.widget.TextView;
  8.  
  9. public class MainActivity extends AppCompatActivity {
  10.     //On déclare notre  TextView ici
  11.     private TextView monTextView;
  12.  
  13.  
  14.     @Override
  15.     protected void onCreate(Bundle savedInstanceState) {
  16.         super.onCreate(savedInstanceState);
  17.         setContentView(R.layout.activity_main);
  18.         //On cible notre textview avec son id
  19.         monTextView = findViewById(R.id.message_acceuil);
  20.  
  21.         //On change le texte du TextView
  22.         monTextView.setText("Le textview a été modifié");
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement