tags:

views:

57

answers:

2

I have created two classes: Example1 and Example2, which extends activity. Example1 contains a UI of buttons, while Example2 contains UI of TextEdit. I want to call Example2 when a button is clicked, so this code is in an onclick method

Intent i = new Intent();
i.setClassName("com.a.ui", "com.a.ui.Example2");
startActivity(i);

So I am able to get the UI of Example2 successfully. What's an alternate way of calling intent?

Is there any alternate way to start an activity?

+1  A: 

you can call like this:

startActivity(new Intent(com.a.ui.this, com.a.ui.Example2.class));
Praveen Chandrasekaran
A: 

You can try this way.

  Intent i = new Intent(com.a.ui.this, com.a.ui.Example2.class);
  startActivity(i);
krunal shah