Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.admin.myapplication;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.Button;
- import android.widget.TextView;
- import android.widget.Toast;
- public class MyActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_my);
- }
- public void changeText(){
- final Button button = (Button) findViewById(R.id.button1);
- final TextView text = (TextView)findViewById(R.id.largetext);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- button.setText("Button has been pressed");
- text.setText("The large text has been changed");
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement