SHARE
TWEET

MainActivity.java

millatip Jan 8th, 2019 354 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package com.example.caribug;
  3.  
  4. import android.os.Bundle;
  5. import android.support.v7.app.AppCompatActivity;
  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.     private Button btn;
  14.     private EditText edt;
  15.  
  16.     @Override
  17.     protected void onCreate(Bundle savedInstanceState) {
  18.         super.onCreate(savedInstanceState);
  19.         setContentView(R.layout.activity_main);
  20.  
  21.         edt = findViewById(R.id.edt);
  22.         btn = findViewById(R.id.btn);
  23.         btn.setOnClickListener(new View.OnClickListener() {
  24.             @Override
  25.             public void onClick(View view) {
  26.                 Toast.makeText(getApplicationContext(), "Hello " + edt.getText().toString(),Toast.LENGTH_SHORT ).show();
  27.             }
  28.         });
  29.     }
  30. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top