Advertisement
SokazGames

onclicknotregistering

Sep 28th, 2014
3,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package com.example.admin.myapplication;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.TextView;
  10. import android.widget.Toast;
  11.  
  12.  
  13. public class MyActivity extends Activity {
  14.  
  15.     @Override
  16.     protected void onCreate(Bundle savedInstanceState) {
  17.         super.onCreate(savedInstanceState);
  18.         setContentView(R.layout.activity_my);
  19.     }
  20.  
  21.     public void changeText(){
  22.  
  23.         final Button button = (Button) findViewById(R.id.button1);
  24.         final TextView text = (TextView)findViewById(R.id.largetext);
  25.  
  26.         button.setOnClickListener(new View.OnClickListener() {
  27.             @Override
  28.             public void onClick(View view) {
  29.  
  30.                 button.setText("Button has been pressed");
  31.                 text.setText("The large text has been changed");
  32.             }
  33.         });
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement