Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. private Button button;
  2. private Button button1;
  3. private Button button3;
  4.  
  5. @Override
  6. protected void onCreate(Bundle savedInstanceState) {
  7. super.onCreate(savedInstanceState);
  8. setContentView(R.layout.activity_main);
  9.  
  10. button = (Button)findViewById(R.id.button);
  11. button1 = (Button)findViewById(R.id.button3);
  12. button3 = (Button)findViewById(R.id.buttonx);
  13. button3.setOnClickListener(new View.OnClickListener() {
  14. @Override
  15. public void onClick(View v) {
  16. openActivityx();
  17. }
  18. });
  19. button.setOnClickListener(new View.OnClickListener() {
  20. @Override
  21. public void onClick(View v) {
  22. openActivity2();
  23. }
  24. });
  25.  
  26. button1.setOnClickListener(new View.OnClickListener() {
  27. @Override
  28. public void onClick(View v) {
  29. openActivity3();
  30. }
  31. });
  32. }
  33.  
  34. public void openActivity2(){
  35. Intent intent2 = new Intent(this, Activity2.class);
  36. startActivity(intent2);
  37. }
  38. public void openActivity3(){
  39. Intent intent = new Intent(this, Model3.class);
  40. startActivity(intent);
  41. }
  42. public void openActivityx(){
  43. Intent intent = new Intent(this , modelx.class);
  44. startActivity(intent);
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement