Creating a Button and Text view : Android Cafe | Android Studio

Publié le: 23 novembre 2019
sur la chaîne: Android Cafe
120
8

Tip : view video in 2x to save time :-)

So here's a quick tutorial in which beginner can learn how they can implement their first text view and Button and add activity to the button . SO, when the user click on button it show a message in response to your OnClick.

in this video you will learn how to implement a button and text view within 5 min.

java Code:

package com.example.buttonapp;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
TextView textView;
Button button;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView.setText("Button app");
}
});
}
}


Sur cette page du site, vous pouvez voir la vidéo en ligne Creating a Button and Text view : Android Cafe | Android Studio durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Android Cafe 23 novembre 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 120 fois et il a aimé 8 téléspectateurs. Bon visionnage!