tags:

views:

708

answers:

3

Dear friends,

I m new to android developement can you pls tell me how to navigate from one Activity screen to another Activity screen .In the first screen i m having one button if i click the button it has to move to another Activity screen.

regards, s.kumaran.

+3  A: 

The most trivial case (called from activity):

startActivity(new Intent(this, ActivityToLaunch.class));

More details here: http://developer.android.com/guide/topics/fundamentals.html

alex
thanks friend..
Kumar
+1  A: 
OnClickListener onClickListener = new OnClickListener() {
    @Override
    public void onClick(View v) {
     startActivity(new Intent(action));
    }
};

Button button = (Button) findViewById(id);
button.setOnClickListener(onClickListener);
Chiwai Chan
Oh god... code formatting!
fiXedd
+6  A: 
Button x.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) 
             {
              Intent i = new Intent(y.this, Activity.class);
              startActivity(i);           
             }
        });

Here we've defined a listener for Button x. The OS will call this method and start the Activity referenced in Intent i.

Here's the official tutorial example: http://developer.android.com/guide/tutorials/notepad/notepad-ex2.html

Will
thanks friend it's really helpful to me..
Kumar