Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. package ru.startandroid.develop.p0211twoactivity;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.widget.Button;
  9.  
  10. public class MainActivity extends Activity implements OnClickListener {
  11.  
  12.     Button btnActTwo;
  13.     Button btnActThree;
  14.  
  15.     /**
  16.      * Called when the activity is first created.
  17.      */
  18.     @Override
  19.     public void onCreate(Bundle savedInstanceState) {
  20.         super.onCreate(savedInstanceState);
  21.         setContentView(R.layout.activity_main);
  22.  
  23.         btnActTwo = (Button) findViewById(R.id.btnActTwo);
  24.         btnActThree = (Button) findViewById(R.id.btnActThree);
  25.         btnActTwo.setOnClickListener(this);
  26.         btnActThree.setOnClickListener(this);
  27.     }
  28.  
  29.     @Override
  30.     public void onClick(View v) {
  31.         switch (v.getId()) {
  32.             case R.id.btnActTwo:
  33.                 Intent intent = new Intent(this, ActivityTwo.class);
  34.                 startActivity(intent);
  35.                 break;
  36.             default:
  37.                 break;
  38.  
  39.         }
  40.     }
  41.     @Override
  42.     public void onClick(View v) {
  43.         switch (v.getId()) {
  44.             case R.id.btnActThree:
  45.                 Intent intent = new Intent(this, Main3Activity.class);
  46.                 startActivity(intent);
  47.                 break;
  48.             default:
  49.                 break;
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement