Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.startandroid.develop.p0211twoactivity;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- public class MainActivity extends Activity implements OnClickListener {
- Button btnActTwo;
- Button btnActThree;
- /**
- * Called when the activity is first created.
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- btnActTwo = (Button) findViewById(R.id.btnActTwo);
- btnActThree = (Button) findViewById(R.id.btnActThree);
- btnActTwo.setOnClickListener(this);
- btnActThree.setOnClickListener(this);
- }
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btnActTwo:
- Intent intent = new Intent(this, ActivityTwo.class);
- startActivity(intent);
- break;
- default:
- break;
- }
- }
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btnActThree:
- Intent intent = new Intent(this, Main3Activity.class);
- startActivity(intent);
- break;
- default:
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement