reenadak

2018-12-15 Android Toast Example

Dec 14th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package com.mukeshdak.mdfirstapp;
  2.  
  3. import android.support.v7.app.AppCompatActivity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.EditText;
  8. import android.widget.TextView;
  9. import android.widget.Toast;
  10.  
  11. public class MainActivity extends AppCompatActivity {
  12.  
  13.     Button b;
  14.     EditText et;
  15.     TextView tv;
  16.  
  17.     @Override
  18.     protected void onCreate(Bundle savedInstanceState) {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.activity_main);
  21.  
  22.         b = (Button) findViewById(R.id.button1);
  23.         tv = (TextView) findViewById(R.id.text_view);
  24.         et = (EditText) findViewById(R.id.text_edit);
  25.  
  26.  
  27.         b.setOnClickListener(new View.OnClickListener(){
  28.  
  29.             public void onClick(View v){
  30.                 Toast.makeText(MainActivity.this, "Daba diya button", Toast.LENGTH_LONG).show();
  31.             }
  32.         });
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment