Button with ClickLister


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Button button_name =(Button)findViewById(R.id.ButtonId);
  2.  
  3. button_name.setOnClickListener(new View.OnClickListener() {
  4. public void onClick(View arg0) {
  5.  
  6. Intent intent_name = new Intent(Activity1.this,Activity2.class);
  7. startActivity(intent_name);
  8.  
  9. }
  10. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.