SHARE
TWEET

Untitled

a guest Feb 17th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.widget_dialog;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.EditText;
  9. import android.widget.Toast;
  10.  
  11. public class MainActivity extends AppCompatActivity {
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_main);
  17.  
  18.         Button btnToast = (Button)findViewById(R.id.btnToast);
  19.         btnToast.setOnClickListener(new View.OnClickListener(){
  20.  
  21.             @Override
  22.                     public void onClick(View v) {
  23.                 EditText txtNama = (EditText) findViewById(R.id.txtNama);
  24.                 String nama = txtNama.getText().toString();
  25.  
  26.                 Toast.makeText(getApplicationContext(), "halo" + nama + "...", Toast.LENGTH_SHORT).show();
  27.             }
  28.         });
  29.          btnToast.setOnClickListener(new View.OnClickListener() {
  30.              @Override
  31.              public void onClick(View view) {
  32.  
  33.              }
  34.          });
  35.  
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top