Advertisement
obernardovieira

Call function when click in Button

May 12th, 2014
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. public class MainActivity extends Activity {
  2.  
  3.     @Override
  4.     protected void onCreate(Bundle savedInstanceState) {
  5.         super.onCreate(savedInstanceState);
  6.         setContentView(R.layout.activity_main);
  7.  
  8.         Button start = (Button) findViewById(R.id.button_start);
  9.         start.setOnClickListener(startListener);
  10.  
  11.  
  12.     }
  13.  
  14.     private View.OnClickListener startListener = new View.OnClickListener() {
  15.         public void onClick(View v) {
  16.             Log.d("MainActivity", "onClick() called - start button");
  17.         }
  18.     };
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement