-2

I am trying to open a activity "one" from the MainActivity when the button "button1" (onClick:one) is pressed. How can I do it?

Monkey
  • 3
  • 3

1 Answers1

0

You need to create a method with name one that takes a View and then create an Intent. Something like this:

public void one(View view) {
    Intent intent = new Intent(this, one.class);
    startActivity(intent);
}
Alex K
  • 8,269
  • 9
  • 39
  • 57
  • When I did this method and tried it on the emulator the "activity_activity1.xml" did not open. Why? Shoud I add something? – Monkey Dec 29 '14 at 16:48