I have an Activity window in the MainActivity file.
The transition button is processed by the following code:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button swith = (Button)findViewById(R.id.button1); swith.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent SecAct = new Intent(getApplicationContext(), SecondActivity.class); startActivity(SecAct); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } It was decided to add another button that leads to another Activity window. How to add a button2 ?
While the transition is working only on one button. I can not understand how to register for the second.
I tried this:
Button swith = (Button)findViewById(R.id.button1); Button swith2 = (Button)findViewById(R.id.button2); swith.setOnClickListener(new OnClickListener(); swith2.setOnClickListener(new OnClickListener() But does not work.